BookmarkSubscribeRSS Feed
lucysas
Fluorite | Level 6

Hi,

I am using the loess procedure to do some time series analysis, of the form:

proc loess data=table;

       model dependent=time / smooth= 0.1 0.2;

       ods output OutputStatistics=results;

  run;

I have a macro array of values I would like to use as the smoothing parameters, i.e. &sparam = {0.05 0.1 0.2 0.5}.

My question is: is it possible to insert the values of the array into the procedure under the smooth option? When I currently write "smooth = &sparam," I receive an unresolved symbol error. When I try to list out the names of all of the array elements using a %do-put loop, I receive an error that the smooth option expects a numeric value.

Any suggestions for how to approach this? I cannot simply write in the numeric values under smooth since I am looping through many times using different calculated values.

Thanks!

Lucy

2 REPLIES 2
Ksharp
Super User

It is worked for me .

%let sparam = { 5 7 8 9 } ;

%let fix_sp=%sysfunc(compress(&sparam,{} ));

proc loess data=sashelp.buy;
       model amount=date / smooth= &fix_sp ;
       ods output OutputStatistics=results;

  run;

Ksharp

lucysas
Fluorite | Level 6

I did not end up using your method, but it is good to find out about the compress function.

Thanks!

Lucy

sas-innovate-2024.png

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.

 

Register now!

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
  • 697 views
  • 3 likes
  • 2 in conversation