The SAS Output Delivery System and reporting techniques

Interleaving fields & more ??

Reply
N/A
Posts: 1

Interleaving fields & more ??

I have a dataset with columns: code, name, a, b, c, aa, bb, cc.
I want to format the dataset to following format & export to excel, what's the best way to do it?

code, name, a, aa, aaa, b, bb, bbb, c, cc, ccc

note: aaa is a calculated field aaa=a/aa, bbb, ccc are the same.

Thanks!
SAS Super FREQ
Posts: 8,866

Re: Interleaving fields & more ??

Hi:
I'd use PROC REPORT and/or ODS CSV or ODS TAGSETS.EXCELXP or ODS HTML.

Consider the following code:
[pre]
ods csv file='myfile1.csv' ;
ods msoffice2k file='myfile2.xls' style=sasweb;
ods tagsets.excelxp file='myfile3.xls' style=sasweb;
proc report data=sashelp.class nowd;
column name age projage height projht;
define name / order;
define age / display;
define projage / computed;
define height /display;
define projht / computed;
compute projage;
** age in 5 years;
projage = age + 5;
endcomp;
compute projht;
** height at 1.25 of current height;
projht = height * 1.25;
endcomp;
run;
ods _all_ close;
[/pre]

If you need more help with PROC REPORT or deciding which one of the ODS destinations is right for your needs, you might consider contacting Tech Support.

cynthia
Ask a Question
Discussion stats
  • 1 reply
  • 115 views
  • 0 likes
  • 2 in conversation