View previous topic :: View next topic
|
Author |
Message |
LOKESH DAIVAM
New User
Joined: 22 Jul 2015 Posts: 4 Location: INDIA
|
|
|
|
Hi Everyone,
SAS code :
Code: |
DATA STAT;
INFILE INDD;
INPUT
@001 CHARGE PD8.7;
PROC MEANS DATA=STAT NOPRINT;
VAR CHARGE;
OUTPUT OUT=REPORT
SUM(CHARGE)=CYCLE26
N=RECS;
RUN; |
I want the sum of charge , that is 'CYCLE26' value alone to be printed in a dataset from position 01 to 20.
Is it possible to print that value in a dataset? If so please explain me how.
thanks in advance. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
After your RUN statement:
Code: |
DATA _NULL_;
SET REPORT;
FILE <ddname> ;
PUT @11 CYCLE26 10. ;
RUN; |
You must specify the output DD name and put that DD name in the FILE statement. Also, a SAS numeric variable on z/OS is no more than 8 bytes long, which allows at most 16 digits. So at least 4 of the bytes between 1 and 20 will be blank (or zero); I assumed a 10-digit number would be adequate; if not, you can adjust the starting position and length of CYCLE26 yourself.
You did not specify -- you ARE running your SAS on a z/OS machine, right? |
|
Back to top |
|
|
LOKESH DAIVAM
New User
Joined: 22 Jul 2015 Posts: 4 Location: INDIA
|
|
|
|
Hi Robert,
Thank you so much, this helped me alot.
Sorry i forgot to mention that am running my sas in AS on a z/OS machine.
I want to print the cycle26 value like this : $400.00000
Am trying with Format,but its showing below erro.
'Variable CYCLE26 has already been defined as numeric.'
Thanks in advance. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
You set the format on the PUT statement:
Code: |
PUT @11 CYCLE26 $10.5; |
|
|
Back to top |
|
|
LOKESH DAIVAM
New User
Joined: 22 Jul 2015 Posts: 4 Location: INDIA
|
|
|
|
Hi Robert,
I tried the same but am getting the same error.
Code: |
13 !
14 DATA _NULL_;
15 SET REPORT;
16 FILE OUTDD ;
17 PUT @01 'CYCLE 26: '
18 PUT @11 CYCLE26 $10.5;
_____
230
WARNING: Variable CYCLE26 has already been defined as numeric. |
Thanks in advance. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
So, do you define that item somewhere else? Is there a manual which explains the messages? How have you attempted to fix it? |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hello,
Change this line
Code: |
PUT @11 CYCLE26 $10.5; |
to
Code: |
PUT @11 CYCLE26 Dollar10.5; |
|
|
Back to top |
|
|
|