Getting a PARM from a file

Reply
Contributor
Posts: 23

Getting a PARM from a file

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;

Super User
Super User
Posts: 6,500

Re: Getting a PARM from a file

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;

Ask a Question
Discussion stats
  • 1 reply
  • 146 views
  • 0 likes
  • 2 in conversation