03-10-2016 04:50 PM
I have multiple libraries with different [z/OS] dataset names that contains identifying information. Using the 'SCAN' function I can retrieve the part of the dataset name containing the identity of the data. The problem is that I can't retrieve the dataset name. Due to some security concerns, I cannot use some of the SAS facilities like (IN=xx) to reliably determine the source of each observation without processing each dataset individually and assigning the source manually.
Can a macro variable like &lib or &libname be retrieved for each observation as it is processed so the identifying incormation can be preserved with the selected records in a single pass of multiple files (E.G. - data xx; set a b c d e...
03-10-2016 05:18 PM
I don't have any code yet. I am trying to figure out if and how to code a program.
From another program using the same data I get the following note:
NOTE: Libref DDP001 was successfully assigned as follows:
Physical Name: MXGT.BIZ.CDTF.P001.SASDATA
I want to bring the Physical Name into the program so I can retrieve any of the levels of the name as the data is being read. When one of the datasets finishes, I need the name to change as the next dataset is processed.
03-10-2016 06:32 PM
I think that you should look at the pathname function. For example,
location = pathname('DDP001','L');
will create a string variable with the value MXGT.BIZ.CDTF.P001.SASDATA
03-10-2016 06:55 PM
This worked, almost. As the source of the observations changed, the value stayed the same because it is keeyed off the DDNAME. I need to know for each observation in the data. This gave the value in only one of the multiple datasets being read.
03-10-2016 07:01 PM
You will need to use both the indsname option and the pathname function. Let's see if I can write the code off the top of my head:
identy = scan(pathname(scan(dsn,1,'.'),'L'),3,'.');
This is not tested. I don't have a mainframe to run it on.
03-10-2016 05:41 PM
I admit to some curiosity as to how (IN=xxx) is a security issue as I would think the dataset name on the set statement would likely contain way more information.
03-10-2016 05:54 PM
I personally do not find it much of a risk, but if the JCL was changed and the dataset name did not match the data source. Someone could actually view another person or group's data. I am dealing with application data and not necessiarily computer usage data.
03-10-2016 06:29 PM
I put together some quick code to test.
%MACRO TESTIT ;
DATA ACTX ;
CDTU01.CDTF01 INDSNAME=DSN ;
KEEP IDENTITY DATE SISID TIME2 CNT ACTVY_STAT_ID
DU_TYPE_CD TECH_FNCTN_ID ;
FORMAT SISID $3.
TECH_FNCTN_ID $12. ;
CNT = 1 ;
IDENTITY = SCAN(DSN,3,".") ;
I do not get any errors, but identity is blank.
SASHELP.VLIBNAME will get the name, but I need the IDENTITY on each record.
03-10-2016 06:43 PM
What does DSN look like before the scan? IF the full name isn't provided there's not much you can do.
For libname - read it in, store as macro variable and assign in data step. Not efficient by doable.