BookmarkSubscribeRSS Feed
Reeza
Super User

Like these? Obviously not styled or customized exactly at this point in time.

 

EDIT: Sorry, realize that was unclear. You're looking for something similar to the attached? 

 

 

Reeza
Super User

Since I'm closing down SAS and this was still open, this is how those were created. Feel free to ignore if it's not helpful.

 

 

/* 1. transpose from wide (Y, X1 ,...,X100) to long (varNum VarName Y Value) */
data Long;
set sashelp.cars;                       /* <== specify data set name HERE         */
array x [*] msrp enginesize horsepower;;         /* <== specify explanatory variables HERE */
do varNum = 1 to dim(x);
   VarName = vname(x[varNum]);  /* variable name in char var */
   Value = x[varNum];           /* value for each variable for each obs */
   output;
end;
keep invoice varN: value;
run;

/* 2. Sort by BY-group variable */
proc sort data=Long;  by VarName;  run;

ods pdf file='c:\_localdata\temp\Reg results.pdf';

ods output parameterEstimates=Pe fitstatistics=fe;
proc reg data=long;
by varName;
model invoice = value;
output out=reg_out p=predicted r=residual;
run;

ods pdf close;

ods pdf file='C:\_localdata\temp\Summary Tables.pdf';

proc print data=PE;
proc print data=FE;
run;

ods pdf close;

ods pdf file='C:\_localdata\temp\Graphs.pdf';

proc sgplot data=reg_out;
by varName;
scatter x=value y=invoice;
scatter x=value y=predicted; 
run;

ods pdf close;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

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
  • 16 replies
  • 2695 views
  • 1 like
  • 4 in conversation