Hello all,
From the parameter output of Proc Model ("Nonlinear OLS Parameter Estimates") I am obtaining the Standard Errors of each of my parameter estimates to append to another file of all my parameter data. Basically the data I get from the ods output is formatted as such:
Parameter | StdErr |
A1 | 0.9174 |
B1 | 0.2323 |
B2 | 0.2418 |
B3 | 0.0778 |
gamma | 0.0145 |
I would like to manipulate this data to a one row data-set as such:
StdErr_A1 | StdErr_B1 | StdErr_B2 | StdErr_B3 | StdErr_gamma |
0.9174 | 0.2323 | 0.2418 | 0.0778 | 0.0145 |
I have been trying to do this by storing the parameter I'm currently on in a datastep to a macro variable that can I use to concatenate a variable name and assign the StdErr to, as such:
data stderr_out2;
set stderr_out;
call symputx("parm", parameter);
stderr_&parm. = StdErr;
run;
This won't give me the desired end-result yet, but I will at least have the correct variable names with their respective values and I can get to this final result with another datastep. However, this is not working at all, I only get one column added that corresponds to the last parameter, i.e. I will get this:
Parameter | StdErr | stderr_gamma |
A1 | 0.917366246 | 0.917366246 |
B1 | 0.232323077 | 0.232323077 |
B2 | 0.241839023 | 0.241839023 |
B3 | 0.077813946 | 0.077813946 |
gamma | 0.014471111 | 0.014471111 |
Rather than a new column for each parameter, only the column from the last macro is placed in the data set. Am I going about this a completely incorrect way? This seems like it should be fairly simple to do and I've gotten somewhat stumped as to what is going on here. Please if you have any suggestions I would appreciate it a great deal.
Thanks!!
-Ryan
I think you want to use PROC TRANSPOSE, with the ID statement, something like (untested)
PROC TRANSPOSE DATA=whatever OUT=transpose;
var stderr;
id parameter;
run;
I think you want to use PROC TRANSPOSE, with the ID statement, something like (untested)
PROC TRANSPOSE DATA=whatever OUT=transpose;
var stderr;
id parameter;
run;
Well I feel really silly that it was that easy!! I don't know why I didn't think of using proc transpose with the ID statement for this. Thank you for the quick answer!!
-Ryan
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.
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.