BookmarkSubscribeRSS Feed
JackG
Calcite | Level 5

I am using Proc FCMP to create an output array for each observation in my data set.  I would like to aggregate those arrays into one data set at the end of Proc FCMP that I can use as input to the next part of my program.  What I tried to do was use the write_array function passing it a macro variable for the data set name (something like rc = write_array('setdata&i', outarray) where I'm using i to loop through each data point earlier on in the procedure.  My thought was then to take each of the setdata&i data sets and aggregate them after the Proc FCMP, but Proc FCMP doesn't seem to like having a macro variable stand in for the data set name.  I've played around with the quotes, etc but nothing seemed to work.  Can anyone help with the right syntax, or an alternative method to aggregate the arrays into one data set?

Thanks in advance!

2 REPLIES 2
FriedEgg
SAS Employee

You design does not sound very good.  Are you attempting to perform some sort of transposition?  The &i variable will not resolve inside single quotes.  Using macro variables inside a compiled function in PROC FCMP would be a pretty poor practice and would not work unless the variable is defined as a global and would potentially have issues being resolved even then.  Why don't you take the time and describe in full what it is you are attempting to do with your input data, provide sample input and output.  The only answer to your current question I could provide is that there is no way to provide you with the syntax of write_array to accomplish what you are seeking to do, which I am not really even sure what that it...

shivas
Pyrite | Level 9

Hi,

If you have SAS risk dimensions licensed you can try some thing like this(don't know is this what you are looking for)

PROC RISK;

ENVIRONMENT OPEN = <options>;

WRITEARRAYS OUT= datasetname ;

ENVIRONMENT SAVE;

RUN;

Thanks,

Shiva

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 892 views
  • 0 likes
  • 3 in conversation