I need to read a PARM from a file and use it in my next datastep but I am unsure how? I tried reading it in and RETAIN it but no good -
I am trying to read in SCHID (data = 001) and then use it to write out some members to LJOB -
SCHID input = 001
Want to output the SCHID with the MEMBER I read in - can it be done in one step? When I read SCHID which only has one record and tried to process the MEMBERS file with many it stopped after one record because the SCHID file hit EOF before MEMBERS did.
Expected output =
LJOB,JOB=MEMBER1 001
LJOB,JOB=MEMBER2 001
DATA SCHID;
RETAIN SCHID;
INFILE SCHID END=EOFIND1 DSD;
INPUT @1 SCHID $3.;
DATA _NULL_;
INFILE MEMBERS END=EOFIND DSD;
INPUT JOBNAME $8.;
FILE LJOB;
PUT @1 'LJOB,JOB='
@10 JOBNAME
@19 SCHID;
Since you read the value from the raw file SCHID into the variable SCHID in the data set SCHID you could try referencing that data set in your second data step.
DATA _NULL_;
if _n_=1 then set schid ;
INFILE MEMBERS END=EOFIND DSD;
INPUT JOBNAME $8.;
FILE LJOB;
PUT @1 'LJOB,JOB='
@10 JOBNAME
@19 SCHID
;
RUN;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.