My previous post tells me I clearly did not have an accurate picture of my data. Earlier, I had said I wanted to count the number of ssn in the data. My objective was to determine the number of absences for each teacher. My approach was short-sighted. Consider "Smith." It appears he was absent 4 days but this is not so. Smith works at two different schools (Park and West) so each school reported the absence for Jan 22 and 23. He was only absent 2 days. I need the count of each teacher's ssn BY school.
Obs | school | ssn | last | date |
1819 | Fair Elementary | 1443 | Jones | 12SEP2014 |
---|---|---|---|---|
7587 | Blue Elementary | 7369 | Brown | 25NOV2014 |
8661 | Park Elementary | 0976 | Smith | 22JAN2015 |
8662 | Park Elementary | 0976 | Smith | 23JAN2015 |
8665 | West Elementary | 0976 | Smith | 22JAN2015 |
8666 | West Elementary | 0976 | Smith | 23JAN2015 |
Proc Freq X 2
proc freq data=have noprint;
table ssn*date/out=temp;
ru;
proc freq data=temp noprint;
table ssn/out=want;
run;
This code gave me the total for school = Park but there's nothing for school= West.
proc freq data=have noprint;
table school*ssn/out=want;
ru;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.