View previous topic :: View next topic
|
Author |
Message |
Charles Wolters
New User
Joined: 30 Mar 2011 Posts: 48 Location: United States
|
|
|
|
I have 25 SAS data libraries and they all have the same file structure. The naming convention is as follows:
RMTPRD.EES.S688CLW.VIREC.VAHLTH.MMMYYYY.DATA
where MMMYYY would be something as APR2016.
The 5 latest libraries we have received use a new coding system for several of the variables which means that the SAS processing will be somewhat different than the processing under the older coding system found on the first 20 mainframe data sets. I know the first data set using the new coding system was OCT2015 and all subsequent data I have received and will receive in the future will use the new coding system.
Ideally I would like to process all 25 data sets in one job but I am having problems determining how the data set information can be passed to SAS so that the correct SAS processing stream can be used.
Charles Wolters |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Quote: |
Ideally I would like to process all 25 data sets in one job |
Hi, Do all the 25 sas datasets have 25 different DD names on the JCL? |
|
Back to top |
|
|
Charles Wolters
New User
Joined: 30 Mar 2011 Posts: 48 Location: United States
|
|
|
|
Vasanthz,
Yes, they all have different DD names on JCL.
Charles Wolters |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Could you show how the 25 datasets are read into the program, a single SET statement or multiple SET statements?
For starters, you can interrogate the physical filename from DD name via the below program.
Code: |
PROC SQL;
SELECT PATH FROM SASHELP.VLIBNAM WHERE LIBNAME = 'DDNAME'
AND UPCASE(SYSNAME) = 'UNIT';
QUIT; |
If you could give some more info on how different DD names are read, then we could suggest a more specific technique. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
For the below DD name,
Code: |
//WELLS DD DISP=SHR,DSN=PRETTY.SAS.DATASET |
A sas program
Code: |
PROC SQL;
SELECT PATH FROM SASHELP.VLIBNAM WHERE LIBNAME = 'WELLS'
AND UPCASE(SYSNAME) = 'UNIT';
QUIT; |
Will give below output
Code: |
path
------------
PRETTY.SAS.DATASET |
You could build upon this technique, by passing the dataset name into a macro variable.
Check PROC SQL section using :INTO clause
Based on the value of Macro variable, you can do differnt coding for different names |
|
Back to top |
|
|
Charles Wolters
New User
Joined: 30 Mar 2011 Posts: 48 Location: United States
|
|
|
|
Vasanthz,
That sounds like a plan. Yes, once you build your list of data sets you can use :INTO clause to create your macro variable. Let me follow through on this and I will get back to you if I run into a snag.
I have never used the VLIBNAM view from SASHELP and I thought that for this technique to work one would have to specify LIBNAME statements in the SAS program rather than DD statements in the JCL. I learned something today.
Charles Wolters |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
Been a while, but I seem to remember a READJFCB option on the INFILE statement. So you could interrogate the datasetname in a DATA step. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hi Charles,
There is also a simpler approach to get the file name
Code: |
//STEP1 EXEC SAS
//WELLS DD DSN=WELLS.SAS.PDB,DISP=SHR
//SYSIN DD *
DATA _NULL_;
LENGTH PHYS_NAME $44;
INFILE WELLS FILENAME=PHYS_NAME;
INPUT;
CALL SYMPUT('PHYS_NAME',PHYS_NAME);
STOP;
RUN;
%PUT THE PHYSICAL FILE NAME IS &PHYS_NAME; |
Output:
Code: |
THE PHYSICAL FILE NAME IS WELLS.SAS.PDB |
|
|
Back to top |
|
|
|