Help using Base SAS procedures

Proc FCMP Write_Array to Dataset with Macro Variable Name

Reply
N/A
Posts: 1

Proc FCMP Write_Array to Dataset with Macro Variable Name

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!

Trusted Advisor
Posts: 1,301

Re: Proc FCMP Write_Array to Dataset with Macro Variable Name

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...

Super Contributor
Posts: 349

Re: Proc FCMP Write_Array to Dataset with Macro Variable Name

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

Ask a Question
Discussion stats
  • 2 replies
  • 298 views
  • 0 likes
  • 3 in conversation