When I run the code below, it outputs a text file where the default hyphen for the headline option is replaced by the letter F. So I get a series of Fs dispayed across my report. Any idea what could be causing this? I've never run across this before and can't find any info about it...
proc printto print='c:\temp\test.txt';
run;
PROC REPORT DATA=SUM_2010 HEADLINE HEADSKIP MISSING nowd;
COLUMNS field1 field2;
DEFINE field1 / 'NUMBER OF things' FORMAT=COMMA20.0 WIDTH=25;
DEFINE filed2 / 'VALUE of things' FORMAT=DOLLAR28.2 WIDTH=30;
RBREAK AFTER/SKIP SUMMARIZE DOL;
TITLE1 "something";
TITLE2 "something something";
TITLE3 "more something";
TITLE4 "YEAR: 2010";
RUN;
quit;
Try the formchar option - this affects horizontal and vertical lines in proc tabulate and proc report. This should provide more appealing output => options formchar="|----||---|-/\<>*"; (run it before the proc report).
Related
I would like to create MACRO to produce a report (proc report) for each of datasets. For each report include title, "CYBOCS Compulsion Scale:Q6_#". Bold the line that has cycle 12 in it as cycle 12 is the primary endpoint. And using ODS RTF to output all reports to the personal drive
Here is the table look like:
Here is my code, I don't sure how to add bold line and how should I use ODS RTF to export reports
ODS RTF
%MACRO diff(var=);
PROC REPORT DATA=table_&var.;
TITLE "CYBOCS COMPULSION SCALE: &var";
RUN;
%MEND diff;
options mprint mlogic;
%diff(var=q6_1a);
%diff(var=q6_1b);
%diff(var=q6_2);
%diff(var=q6_3);
%diff(var=q6_4);
%diff(var=q6_5);
%diff(var=q6_6);
%diff(var=q6_7);
%diff(var=q6_date);
Use a compute block and add your condition. You can use call define() to conditionally change a style based on your logic. For example, if we wanted to bold the row for every BMW in sashelp.cars:
proc report data=sashelp.cars;
compute Make;
if(Make = 'BMW') then call define(_ROW_, 'style', 'style=[font_weight=bold]');
endcomp;
run;
I'm trying to export quartile information on a grouped dataset as a dataset in SAS but when I run this code my output is a table with the correct information displayed but the dataset WORK.TOP_1O_PERC is only summary statistics of the set (no quartiles). Does anyone know how I can export this as the CLASS (PDX) and its 25th and 75th percentiles? Thanks!
PROC MEANS DATA=WORK.TOP_10_DX P25 P75;
CLASS PDX;
VAR AmtPaid;
OUTPUT OUT = WORK.TOP_10_PERC;
RUN;
I like the STACKODS output that is a data set which is like the default printed output.
proc means data=sashelp.class n p25 p75 stackods;
ods output summary=summary;
run;
proc print;
run;
You can use output statement with <statistics>= options.
PROC MEANS DATA=WORK.TOP_10_DX NOPRINT;
CLASS PDX;
VAR AmtPaid;
OUTPUT OUT = WORK.TOP_10_PERC P25=P25 P75=P75;
RUN;
Compared to ods output, output statement is much faster but less flexible with multiple analysis variables or by statement specified situation.
I use SAS ODS a lot to export prettied up excel files. One in particular has titles that go significantly longer than the width of all of the columns, so they word wrap, which makes the file look horrible.
Is there any way to export a file with word wrap turned off? I've searched on the SAS support forums, and have found very little helpful information.
%let myfile = "C:\Users\dicegods\testfile.xlsx";
ods excel file=&myfile. options (orientation='portrait' sheet_name='Baseball' embedded_titles='yes');
options LeftMargin=0.25in RightMargin=0.25in TopMargin=0.25in BottomMargin=0.25in;
proc report data=sashelp.baseball;
column name nHome nHits;
define name / display 'Name';
define nHome / display 'Homers' sum;
define nHits / analysis 'Hits' sum;
title; title1 J=L "Baseball Players from SAS Help Database - sashelp library inEG - more run on stuff";
run;
Try using ODS TEXT. The following code snippet shows a simple way to use ODS TEXT to insert a "title" into the top of the sheet being generated by the following PROC step. Look up the documentation on ODS TEXT to see how to control the formatting of the generated text
%let myfile = "C:\downloads\testfile.xlsx";
ods excel file=&myfile. options (orientation='portrait' sheet_name='Baseball' embedded_titles='no');
ods text="Baseball Players from SAS Help Database - sashelp library inEG - more run on stuff";
options LeftMargin=0.25in RightMargin=0.25in TopMargin=0.25in BottomMargin=0.25in;
proc report data=sashelp.baseball;
column name nHome nHits;
define name / display 'Name';
define nHome / display 'Homers' sum;
define nHits / analysis 'Hits' sum;
title J=L "Baseball Players from SAS Help Database - sashelp library inEG - more run on stuff";
run;
title;
ods excel close;
I think you need this option, FLOW, as shown in the image below.
I'm generating tables with rolling weeks of data, so my columns have to be named in the yyyymmdd format like 20161107. I need to apply a comma format to these columns to display counts, but the format is also being applied to the column name so 20161107 turns into 20,161,107. Below is example code that shows the error:
data fish; set sashelp.fish;
TEST = WIDTH*1000;
run;
ods tagsets.excelxp file = "C:\User\Desktop\test.xls" style=minimal
options(embedded_titles="yes" autofit_height="yes" autofilter="all");
proc report data = fish spanrows nowd &header_style.;
column SPECIES TEST;
define SPECIES / display;
define TEST / display "20161107"
f=comma12. style={tagattr='format:###,###,###'}; /* ERROR OCCURS WITH THIS STYLE */
title1 bold "sashelp.fish title";
run; title1;
ods tagsets.excelxp close;
It looks like I can fix this error by padding the display name with spaces like " 20161107 " but I'm not hardcoding these names, so I'd like to try to fix it in the proc report syntax first if possible. Any insight?
You should tell SAS to only apply that style to the column, then:
define TEST / display "20161107"
f=comma12. style(column)={tagattr='format:###,###,###'};
Then it should work as you expect.
Styles in PROC REPORT typically have multiple things they can apply to, and if you don't specify which they apply to all. style(header), style(report), etc. are all options - you can see the full list, plus a good explanation, in the SAS paper Using Style Elements in the REPORT and TABULATE procedures.
So I've writen this:
ods rtf file = "D:\Sarath\List\2.rtf";
proc report data = list.lst1;
column PATIENT EOSDT STDRUG STDRUGSP STDCOMP STDCOMSP DAY5 EOSREAS;
define PATIENT/display "Subject * Number";
define EOSDT /order "Date of * Study Completion/ * Early Discontinuation";
define STDRUG/order "Administered*Study Drug?";
define STDRUGSP/display "If no,*Specify" ;
define STDCOMP/order "Completed*Dosing";
define STDCOMSP/display "If no,*Specify";
define DAY5/order "Completed*Study?";
define EOSREAS/display "Reason for * not Completing";
run;
ods rtf close;
and it creates an rtf with no data. Just a blank page. Please tell me what am I doing wrong here.
Regards.
Add nowd to the proc report line, otherwise SAS is expecting proc report to be an interactive procedure.
proc report data = list.lst1 nowd;
See documentation here:
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a002473620.htm