I have multiple text files in my personoal folder in SAS
"/home/gandhis7/Drop/" this is the location.
I want to copy the files from this location to another location in SAS. I have the following code to copy the files but this code allows me to do it only one file at a time.
your help will be much appreciated in this matter.
Data work.UMRPN054694;
Length
U01 $3
Meter_Point_Reference 8
Actual_Read_Date 8
Meter_Reading_Source $2
Meter_Reading_Reason $2
Meter_Serial_Number $14
Meter_Reading 8
Meter_Round_The_Clocking 8
Convertor_Serial_Number $1
Convertor_Uncorrected_Reading $1
Convertor_Round_the_Clock_Count $1
Tolerance_Override_Flag $1;
FORMAT
U01 $CHAR3.
Meter_Point_Ref BEST10.
Actual_Read_Date YYMMDD10.
Meter_Reading_Source $CHAR1.
Meter_Reading_Reason $CHAR1.
Meter_Serial_Number $CHAR14.
Meter_Reading BEST7.
Meter_Round_The_Clocking BEST1.
Convertor_Serial_Number $CHAR1.
Convertor_Uncorrected_Reading $CHAR1.
Convertor_Round_the_Clock_Count $CHAR1.
Tolerance_Override_Flag $CHAR1.;
INFORMAT
U01 $CHAR3.
Meter_Point_Ref BEST10.
Actual_Read_Date YYMMDD10.
Meter_Reading_Source $CHAR1.
Meter_Reading_Reason $CHAR1.
Meter_Serial_Number $CHAR14.
Meter_Reading BEST7.
Meter_Round_The_Clocking BEST1.
Convertor_Serial_Number $CHAR1.
Convertor_Uncorrected_Reading $CHAR1.
Convertor_Round_the_Clock_Count $CHAR1.
Tolerance_Override_Flag $CHAR1.;
Infile "/home/gandhis7/Drop/PN054694.txt" DLM=',' MISSOVER DSD ;
Input U01 Meter_Point_Reference Actual_Read_Date Meter_Reading_Source
Meter_Reading_Reason Meter_Serial_Number Meter_Reading Meter_Round_The_Clocking
Convertor_Serial_Number Convertor_Uncorrected_Reading Convertor_Round_the_Clock_Count
Tolerance_Override_Flag;
run;
Proc Print data=work.UMRPN054694;
Where U01 = 'U01';
run;
It sounds like you're trying to import multiple text files into a single dataset. If so, see the link above for step by step instructions on how to do this in a single step.
Hi Reeza
Thank you for your response, However I have been trying to follow the instructions you provided me and i am getting a little bit confused with the lenghs etc. Can you please elaborate a little more. I wamt to move the following files from 1 location in sas to another.
for example I would like to move following files from (all variables in the files are the same as my original message)
/home/zzzzzzz7/Drop/
PN054694.txt
PN054695.txt
PN054696.txt
Move them to Libref in SAS
RichBase
Your help in this matter is much appreciated
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.
Ready to level-up your skills? Choose your own adventure.