I am having variables stage wise. For example stage 1, stage2 and stage 3. It consist of values 0 and 1. If we assume for 10 applicants then how to count the no. of applicants in stage 1, like wise stage 2 and 3. Want to show each stage count.
Appli no stage1 stage2 stage3
1 0 1 1
2 1 0 0
I have done :
if stage1>0 then
else return 0
Alternative to @Patrick's solution you can use proc summary or proc means and some other procedures:
proc summary data=have <missing noprint>; * the last are optional; class appli_no; /* or just class; for final total */ var stage1-stage3; output out=result sum=; run;
Providing a SAS data step creating the full sample data and showing the desired result would help.
Proc Summary might be what you're really after but given your a bit underspecified question here one way to go.
data have; input Appli_no stage1 stage2 stage3; datalines; 1 0 1 1 2 1 0 0 3 0 0 1 ; data want; set have end=last; retain s1 s2 s3; s1+stage1; s2+stage2; s3+stage3; if last then output; keep s1 s2 s3; run;
I don't know all in's and out's of VA, but sponanously I think your data should be restructured so it can handle more dynamic requets.
a tronspose so you'll have:
Appli_no Stage 1 2 1 3 2 1
I see no immediately need to fill in stages with 0, but that depends what a 0 means in your original data. If you need it just an extra columns with 0/1.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.