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;

sas-innovate-2024.png

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.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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