Hi Guys
Am Rusty at this, so please excuse the dumb question - but its driving me mad!
Start Point
I have to read a large SAS file where each record contains (amongst other things) a char field NAM containing a variable name i.e 123abc99qz.
This field is part of a full path id for a SAS Library i.e. /DIR1/DIR2/DIR3/123abc99qz/DIR4/.
So, for each record on the input SAS file I need to:
(1)Extract the NAM variable & Create the full path id . I do it thus :
DATA FRED1;
Attrib FULL_PATH Length Length=$40;
Set INPUT_FILE(Keep=NAM);
FULL_PATH = '/PATH1/PATH2/' || NAM || '/PATH4/';
ARRAY FP_ARRAY (1) $ FULL_PATH;
/* each FP_ARRAY variable now contains a valid SAS Library name */
RUN;
(2) I now need to assign the value of each iteration of FULL_PATH to a variable that I can use to allocate a libname......
DO I = 1 to DIM(FP_ARRAY)
CALL SYMPUT ('LIB_ID',FP_ARRAY(i));
LIBNAME LIBLIB "&LIB_ID".
END;
(2)Run Proc sort on a filename in this Library with "out=" & "where" parameters.
Easy - once the Library can be assigned
PROC SORT DATA=LIBLIB.filename;
OUT=CUT1;
WHERE();
(3)Run Proc Append to add the out= file specified previously to a permanent D/Set
(Again - Easy once the Library is assigned)
(4) Read the next record on the File untill all are processed.
I know that all processing must be done within FRED1 else the array will disappear...but it has me tearing my hair out.
Any advice on how to proceed (or indeed, an alternate processing suggestion) would be most appreciated.
... View more