Programming the statistical procedures from SAS

Parameter estimates by group - can I output them all in one table?

Accepted Solution Solved
Reply
Contributor
Posts: 24
Accepted Solution

Parameter estimates by group - can I output them all in one table?

Hello everyone,

I'm running a multiple regression by group; basically, I have a long list of stock trade data for various companies organized by ticker symbol and a regression is being run by symbol.  The result is a set of parameter estimates for each company.  When it's time to copy these parameter estimates into excel, it takes me ages because each set of parameter estimates is in a table on its own and i have to manually copy + paste the contents one by one.  Is there anyway to have all parameter estimates appear in one table by ticker symbol?  Something like this:

Ticker Symbol (Parameter estimate A)(Parameter estimate B)
ABC0.00212
BBB0.0134
D0.00414
XYZ0.0799

Since a lot of the parameter estimates have several zeros after the decimal (for example: 0.0000002331), I need to make sure the table provides enough decimal places for the estimates (in other words, I don't want it to be reported as "0.00").

Any help is greatly appreciated.  As a SAS beginner, I must say I have learnt a great deal from these boards.  Thanks in advance.


Accepted Solutions
Solution
‎02-20-2013 05:40 PM
Super User
Posts: 18,528

Re: Parameter estimates by group - can I output them all in one table?

2.77 isn't rounded, change the format if you want to see more decimal places.

ie e12. or something.

View solution in original post


All Replies
PROC Star
Posts: 7,416

Re: Parameter estimates by group - can I output them all in one table?

Would you get what you need by using the outtest option (see: SAS/STAT(R) 9.2 User's Guide, Second Edition )?  Otherwise, you should be able to get them from the ODS tables.

Contributor
Posts: 24

Re: Parameter estimates by group - can I output them all in one table?

Thanks Arthur.  I was able to get the table I needed; however, the table still rounds values.  For example 2.767E-08 is coming up as 0.000000028.  I don't know how to keep them in their original scientific format.

Super User
Posts: 18,528

Re: Parameter estimates by group - can I output them all in one table?

The format is probably just rounded, try applying a different format to the variables of interest.

Contributor
Posts: 24

Re: Parameter estimates by group - can I output them all in one table?

In the original output, where the parameter estimates are reported by symbol in individual tables, there is no rounding.  When I create that new table they get rounded.  I wonder if there is a way I can specify no rounding in the outest function.

Super User
Posts: 18,528

Re: Parameter estimates by group - can I output them all in one table?

I don't think you're talking about 'rounding', I think you're talking about the format applied to the data.

I don't know of a way to change the format in the output step. I'd change it in a second step or where I was going to use or manipulate the format.

Contributor
Posts: 24

Re: Parameter estimates by group - can I output them all in one table?

I think it is being rounded because when I run the proc reg step without the outest option the parameter estimate for the first symbol comes up as 2.767E-08 in the output.  When I throw in the outest, the new table that contains all the symbols and their parameters is showing 0.000000028 for that same parameter estimate.

Super User
Posts: 18,528

Re: Parameter estimates by group - can I output them all in one table?

What happens when you do the following. Replace the have with the dataset you created from outest and the parameters with the names of your variables that you think are 'rounded'.

data want;

set have;

format parameters e10.;

run;

Contributor
Posts: 24

Re: Parameter estimates by group - can I output them all in one table?

Hmm, it didn't change anything.


This is the original table i get after running proc reg:

                                                           Parameter  Estimates AMD
VariableDFParameter EstimateStandard Errort ValuePr > |t|
signchange10.013830.00003093447.04<.0001
LAGQV11.40022E-073.65E-0938.39<.0001
sign10.001680.0000384743.74<.0001
QV12.767E-085.03E-095.5<.0001


This is the first row of the table i get from the OUTEST (ive underlined the parameter estimates that correspond to the table above):

Obssymbol_MODEL__TYPE__DEPVAR__RMSE_signchangeLAGQVsignQVPchangeparameters
1AMDMODEL1PARMSPchange0.029090.013831.4E-070.001682.8E-08-1.

As you can see, it's still rounding.  Did I apply your code properly?  The codes that I used are:

PROC REG data=GH2 outest=est;
by symbol;
model Pchange = signchange LAGQV sign QV / noint;

data FINAL;
set est;
format parameters e10.;
run;


proc print data = FINAL;
run;
quit;

Super User
Posts: 18,528

Re: Parameter estimates by group - can I output them all in one table?

No you didn't. See the part about changing the parameters line.

data FINAL;

set est;

format LAGQV QV e10.;

run;

Contributor
Posts: 24

Re: Parameter estimates by group - can I output them all in one table?

With the parameters corrected...  still rounded but in scientific format.
Obssymbol_MODEL__TYPE__DEPVAR__RMSE_signchangeLAGQVsignQVPchange
1AMDMODEL1PARMSPchange0.029091.38E-021.40E-071.68E-032.77E-08-1
Solution
‎02-20-2013 05:40 PM
Super User
Posts: 18,528

Re: Parameter estimates by group - can I output them all in one table?

2.77 isn't rounded, change the format if you want to see more decimal places.

ie e12. or something.

Contributor
Posts: 24

Re: Parameter estimates by group - can I output them all in one table?

Amazing. Sorry for not realizing that :smileyblush:.

Thanks so much your help Reeza and Arthur, I really appreciate it!

-Razzle

Contributor
Posts: 24

Re: Parameter estimates by group - can I output them all in one table?

Woops I left out the parameters that time, but I just ran it again with the parameters and it does brings up the exact same rounded values, but instead of bringing them in number format it brings them up (still rounded) in scientific format.

🔒 This topic is solved and locked.

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

Discussion stats
  • 13 replies
  • 309 views
  • 4 likes
  • 3 in conversation