A1234567BC012,A
15/FEB/1980,Y,Male,Married,3,FT,55000
3/JUN/1982,N,Female,Married,3,UE,0
24/JAN/2005,N,Male,Unknown,2,NA,0
D135EG023456789,B
19/OCT/1950,Y,Female,Divorced,0,PT,5000
X123A567F9,A
B2345234CC,A
21/MAY/1975,N,Male,Married,2,FT,30000
30/JUN/1978,Y,Female,Married,1,PT,10000
It consists of a header record for a household and is immediately followed by one record (row) for each household member, if applicable. For example, a household of three members will have three records exactly after its header record. How can i read the header only
data want;
infile "path_to_your_file" dsd;
input household :$15. type :$1.;
if "A" le substr(household,1,1) le "Z";
run;
data want;
infile "path_to_your_file" dsd;
input household :$15. type :$1.;
if "A" le substr(household,1,1) le "Z";
run;
thanks for helping me on pervious question. May I ask that how to let the programme know how many record under the Header? Thank a lot!
@ericykc wrote:
thanks for helping me on pervious question. May I ask that how to let the programme know how many record under the Header? Thank a lot!
You should probably start a new thread: "how to read a hierarchical file, with household ID and number of household members".
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.