Hi all,
First name here and in need of some assistance. I have a dataset that looks something like the following:
Q4 Q5_1 Q5_2 Q5_3
1 1 1 2
2 1 1 1
1 1 0 2
5 2 1 2
The values within the Q5_1, Q5_2, and Q5_3 columns are of the same type and I am looking to determine the frequency of the responses across the entire matrix (Q4 is a participant type). I have been able to develop an IML code to produce an output table for just one of the participant types as below.
PROC IML;
Use Data.Have;
Read all var{Q5_1 Q5_2 Q5_3} where (Q4 = 1) into x;
Close;
Call tabulate(level,freq,x,);
Print (level`)[l='level'] (freq`)[l='freq'];
Quit;
This generates an output table that looks like the following:
0 | 151 |
1 | 1399 |
2 | 206 |
What I am wondering is if it is possible to save this output table as a new dataset after using the Call Tabulate function?
Appreciate any and all suggestions and thank you!
Yes. you could. but you have to post it at IML forum.
https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/bd-p/sas_iml
data have; input Q4 Q5_1 Q5_2 Q5_3; cards; 1 1 1 2 2 1 1 1 1 1 0 2 5 2 1 2 ; PROC IML; Use Have; Read all var{Q5_1 Q5_2 Q5_3} where (Q4 = 1) into x; Close; Call tabulate(level,freq,x,); create want var{level freq}; append ; close; Quit;
Yes. you could. but you have to post it at IML forum.
https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/bd-p/sas_iml
data have; input Q4 Q5_1 Q5_2 Q5_3; cards; 1 1 1 2 2 1 1 1 1 1 0 2 5 2 1 2 ; PROC IML; Use Have; Read all var{Q5_1 Q5_2 Q5_3} where (Q4 = 1) into x; Close; Call tabulate(level,freq,x,); create want var{level freq}; append ; close; Quit;
Will do! Thank you 🙂
Hi all,
First name here and in need of some assistance. I have a dataset that looks something like the following:
Q4 Q5_1 Q5_2 Q5_3
1 1 1 2
2 1 1 1
1 1 0 2
5 2 1 2
The values within the Q5_1, Q5_2, and Q5_3 columns are of the same type and I am looking to determine the frequency of the responses across the entire matrix (Q4 is a participant type). I have been able to develop an IML code to produce an output table for just one of the participant types as below.
PROC IML;
Use Data.Have;
Read all var{Q5_1 Q5_2 Q5_3} where (Q4 = 1) into x;
Close;
Call tabulate(level,freq,x,);
Print (level`)[l='level'] (freq`)[l='freq'];
Quit;
This generates an output table that looks like the following:
0 | 151 |
1 | 1399 |
2 | 206 |
What I am wondering is if it is possible to save this output table as a new dataset after using the Call Tabulate function?
Appreciate any and all suggestions! Thank you 🙂
KSharp has already answered your question. See the end of his program.
Oh I see it now! Thank you 🙂
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.