hi everyone,
i need help with these
1) how do i get the freq for just the front row.this is what i did
proc freq data=merged;
tables seat * sex/nocum ;
run;
2) how do i get the percentage of students that missed 0 classes,1-3 classes or more than 3 classes.
This is what i did;
*Created new data set called newset to recode the missclas variable as Mclass;
data newset;
set merged;
if 0<=missclass<=1 then mclass='Low';
else if 1<=missclass<=3 then mclass='Avg';
else if missclass>3 then mclass= 'High';
run;
proc print data=newset;
*Percent of students that missed class using the newset data;
proc freq data =mclass;
tables mclass/ norow nocol nocum;
title 'Percent of students based on gender and classes Missed';
b)i was also thinking of this;
proc format
value $mclass '0'=good
'1-3'=fair
'3+'=bad
proc freq data =merged;
table missclass;
format missclass $mclass.;
please help;
Thanks
@pinkyloop wrote:
1) how do i get the freq for just the front row.this is what i did
proc freq data=merged;
tables seat * sex/nocum ;
run;
proc freq data=merged(where=(seat='Front'));
tables sex;
run;
2) how do i get the percentage of students that missed 0 classes,1-3 classes or more than 3 classes.
proc format;
value missf 0='0' 1-3='1-3' 4-high='>3';
run;
proc freq data=merged;
tables missclass;
format missclass missf.;
run;
What do you mean by "just the front row"?
Please show us what you are getting, and in detail, explain why this isn't what you want and exactly what you do want. Please provide (a portion of) your data for us to see.
the question says
calculate the percentage of female students who sat in the front row and compare it to the male students who sat in the front row.
usint the proc freq for the table sex *sex.i get the freq for all the row of seat both male and females sat.
We don't know how "front row" is identified in the data.
We need to see (a portion of) your data, with explanation.
please see attached part of the data i am working with
Thanks
@pinkyloop wrote:
1) how do i get the freq for just the front row.this is what i did
proc freq data=merged;
tables seat * sex/nocum ;
run;
proc freq data=merged(where=(seat='Front'));
tables sex;
run;
2) how do i get the percentage of students that missed 0 classes,1-3 classes or more than 3 classes.
proc format;
value missf 0='0' 1-3='1-3' 4-high='>3';
run;
proc freq data=merged;
tables missclass;
format missclass missf.;
run;
@pinkyloop wrote:
Thank you so Much!
@PaigeMiller's solution is one demonstration of an extremely powerful tool in SAS: Formats. Almost any grouping that needs to be done based on a single variable should at least consider the use of a format instead of adding a variable.
The groups created by formats are generally honored by most analysis, reporting and graphing procedures. So they can be extremely handy for examining data behavior. You can create multiple formats and see the results by just changing the format associated for use in a procedure.
Also if you have lists that change occasionally, think store, building name, teacher it can be easier to modify a format to use the current association then to modify data sets.
And the flip side of the format, the informat (invalue statement in Proc Format) can be used to read data into consistent forms or identify data entry errors or unexpected values.
hi everyone,
i need help with these
1) how do i get the freq for just the front row.this is what i did
proc freq data=merged;
tables seat * sex/nocum ;
run;
2) how do i get the percentage of students that missed 0 classes,1-3 classes or more than 3 classes.
This is what i did;
*Created new data set called newset to recode the missclas variable as Mclass;
data newset;
set merged;
if 0<=missclass<=1 then mclass='Low';
else if 1<=missclass<=3 then mclass='Avg';
else if missclass>3 then mclass= 'High';
run;
proc print data=newset;
*Percent of students that missed class using the newset data;
proc freq data =mclass;
tables mclass/ norow nocol nocum;
title 'Percent of students based on gender and classes Missed';
b)i was also thinking of this;
proc format
value $mclass '0'=good
'1-3'=fair
'3+'=bad
proc freq data =merged;
table missclass;
format missclass $mclass.;
please help;
Thanks
There's no need to post the same question twice. All replies should go into your other thread.
https://communities.sas.com/t5/SAS-Studio/proc-freq-help/td-p/594726
ok thanks!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.