BookmarkSubscribeRSS Feed
ericykc
Fluorite | Level 6

ericykc_0-1698680805433.png

this is the output, and i want to put the final count and the hhid in the same row. May anyone teach me? Thank a lot.

Here my code,

 

data Member;
infile '~/MS3251/Raw Data/Surref.txt' dlm=',';
input dummy_var : $15. @;
if substr(dummy_var,1,1) ^in (0:9) then do;
input @1 hhid : $15. hhtype $;
no_count = 0;
retain dummy_var;
end;
else do;
no_count + 1;
if no_count > 0 then do;
input @1 birthdate : date11. householder_ind $ gender : $6. martial_status : $8. education employment_status $ income ;
if gender='Male' then no_males+1;
mem = no_count;
keep hhid hhtype mem no_count birthdate no_males;
end;
end;
run;

1 REPLY 1
ballardw
Super User

Data and what you expect the result to look like.

Put where? in a data set? A report? What sort of report?