hello all,
I want to read this raw data ,that i attached here, in sas.But there is a problem in my coding i can not find the right start point for each variable when using @ in the input statement, also the length of each variable is not clear for me.Bellow is my code. Any help is appreciated !
data tempy;
infile "C:\Users\FATEMEH\Desktop\summer2017work\temp.txt";
input @1 dept$5. @7 wagecat$1. @8 wagerate 7.2 @16manager$7. @23 jobtype 3.;
proc print data=tempy;run;
It appears that your data is TAB delimited.
Try
data tempy; infile "C:\Users\FATEMEH\Desktop\summer2017work\temp.txt" dlm='09'x; informat dept $5. wagecat $1. wagerate 7.2 manager $7. jobtype 3.; input dept wagecat wagerate manager jobtype ; run;
I moved the informats to a separate line as they can cause issues when reading delimited text by forcing a read longer than the values that appear when the values have varying lengths such as your wagerate (5 to 7 ) and manager (4 to 7 characters).
It appears that your data is TAB delimited.
Try
data tempy; infile "C:\Users\FATEMEH\Desktop\summer2017work\temp.txt" dlm='09'x; informat dept $5. wagecat $1. wagerate 7.2 manager $7. jobtype 3.; input dept wagecat wagerate manager jobtype ; run;
I moved the informats to a separate line as they can cause issues when reading delimited text by forcing a read longer than the values that appear when the values have varying lengths such as your wagerate (5 to 7 ) and manager (4 to 7 characters).
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.