BookmarkSubscribeRSS Feed
srosenfe
Fluorite | Level 6

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;

1 REPLY 1
Tom
Super User Tom
Super User

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;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 765 views
  • 0 likes
  • 2 in conversation