proc means data=pg1.np_westweather noprint; where Precip ne 0; var Precip; class Name Year; ways 2; output out=rainstats n=RainDays sum=TotalRain; run; title1 'Rain Statistics by Year and Park'; proc print data=rainstats label noobs; var Name Year RainDays TotalRain; label Name='Park Name' RainDays='Number of Days Raining' TotalRain='Total Rain Amount (inches)'; run; title;
what this program actually do it gives sometime the missing values ?!
This looks correct to me.
When you specify WAYS 0, SAS does not slice the data by either ParkName or Year. You get the overall N and overall SUM, and so ParkName and Year are missing.
When you specify WAYS 1, SAS slices the data first by ParkName only (not by Year, so year is missing) and the it slices the data by Year only (not by ParkName, so ParkName is missing).
Where are the missing values? Are they missing for RainDays or TotalRain? If so, then your original data has missing values, or your data has lots of zero which are excluded by your code's WHERE statement.
If the missing values are somewhere else, show us the output.
SHOW US what you are seeing. Show us the exact code that created the output you are showing us. Include your screen capture of the output by clicking on the "Insert Photos" icon. Do not attach files.
This looks correct to me.
When you specify WAYS 0, SAS does not slice the data by either ParkName or Year. You get the overall N and overall SUM, and so ParkName and Year are missing.
When you specify WAYS 1, SAS slices the data first by ParkName only (not by Year, so year is missing) and the it slices the data by Year only (not by ParkName, so ParkName is missing).
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 use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.