DATA Step, Macro, Functions and more

data manipulation question

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 105
Accepted Solution

data manipulation question

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:

ParameterStdErr
A10.9174
B10.2323
B20.2418
B30.0778
gamma0.0145

I would like to manipulate this data to a one row data-set as such:

StdErr_A1StdErr_B1StdErr_B2StdErr_B3StdErr_gamma
0.91740.23230.24180.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:

ParameterStdErrstderr_gamma
A10.9173662460.917366246
B10.2323230770.232323077
B20.2418390230.241839023
B30.0778139460.077813946
gamma0.0144711110.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


Accepted Solutions
Solution
‎08-06-2013 12:59 PM
Trusted Advisor
Posts: 1,933

Re: data manipulation question

Posted in reply to AllSoEasy

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;

View solution in original post


All Replies
Solution
‎08-06-2013 12:59 PM
Trusted Advisor
Posts: 1,933

Re: data manipulation question

Posted in reply to AllSoEasy

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;

Frequent Contributor
Posts: 105

Re: data manipulation question

Posted in reply to AllSoEasy

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

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 178 views
  • 0 likes
  • 2 in conversation