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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1200 views
  • 3 likes
  • 2 in conversation