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