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?

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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 lock in 2025 pricing—just $495!

Register now

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 698 views
  • 0 likes
  • 2 in conversation