BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
KALLEN
Obsidian | Level 7

I need to add the outputs of proc means (5, 10, and 20 year averages) as new variables to an existing dataset (aug_yearly_weather) in the data step, but receive this error message:

 

ERROR: DATA STEP Component Object failure. Aborted during the COMPILATION phase.
ERROR 557-185: Variable demo5 is not an object.

 

 Below is my code:

 

 

/*find 5 year average of the number of days in August that were =>90 by year (2014 - 2018)*/
proc means data=demo5.aug_yearly_weather mean maxdec=0;
	vars Max_Temp_90;
	where date between '01aug2013'd and '31Aug2018'd; /* 5 year average includes 2014 - 2018, but must specify dates between 2013 and 2018*/
	title "5 Year Average";
	output out=demo5.aug_5_year_avg_90;
run;

/*find 10 year average of the number of days in August that were =>90 by year (2009 - 2018)*/
proc means data=demo5.aug_yearly_weather mean maxdec=0;
 where date between '01aug2008'd and '31Aug2018'd; /* 10 year average includes 2009 - 2018, but must specify dates between 2008 and 2018*/
 vars Max_Temp_90;
 title "10 Year Average";
 output out=demo5.aug_10_yr_avg_90;
run;

/*find 20 year average of the number of days in August that were =>90 by year (1999 - 2018)*/
proc means data=demo5.aug_yearly_weather mean maxdec=0;
 vars Max_Temp_90; /* no need to specify date range because this includes the entire dataset */
 title "20 Year Average";
 output out=demo5.aug_20_yr_avg_90;
run;

/* Create the 5, 10, and 20 year averages variables within the dataset aug_yearly_weather */
data demo5.aug_yearly_weather1; 
	set demo5.aug_yearly_weather;
  	Five_year_avg_90 = demo5.aug_5_year_avg_90;
        Ten_year_avg_90 = demo5.aug_10_year_avg_90;
        Twenty_year_avg_90 = demo5.aug_20_year_avg_90;
run;

 

 

Below is the desired result:

DateMax_Temp_905 Year Avg10 Year Avg20 Year Avg
199925242625
200027242625
200125242625
200229242625
200327242625
200422242625
200519242625
200611242625
200727242625
200817242625
200929242625
201027242625
201130242625
201230242625
201326242625
201417242625
201531242625
201620242625
201725242625
201828242625

 

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
I posted the answer in your previous question.

View solution in original post

2 REPLIES 2
Reeza
Super User
I posted the answer in your previous question.
KALLEN
Obsidian | Level 7

Thanks again!

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
  • 2 replies
  • 3233 views
  • 0 likes
  • 2 in conversation