BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Bhagyalakshmi
Fluorite | Level 6
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 ?!

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

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).

--
Paige Miller

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
Bhagyalakshmi
Fluorite | Level 6
I used ways statement 2 i doesnt show any missing unless i used the following program by ways 0 1 only it show the some missing in year but not in name
PaigeMiller
Diamond | Level 26

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.

 

Capture.PNG

--
Paige Miller
Bhagyalakshmi
Fluorite | Level 6

this is  ways 0 option i gave in proc means stepthis is ways 0 option i gave in proc means stepthis is the ways  1 option i gave in proc means stepthis is the ways 1 option i gave in proc means stepthis is for ways 2 option i gave in proc means stepthis is for ways 2 option i gave in proc means step

PaigeMiller
Diamond | Level 26

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).

--
Paige Miller

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 875 views
  • 2 likes
  • 2 in conversation