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: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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