Should I use "Trim" or "Compress"? The Q is: Modify the code used to create the profits report so the spaces after the Q’s in the title “Based on data from Q 1 2011 to Q 4 2013” disappear; that is, so the new title reads “Based on data from Q1 2011 to Q4 2013”. Of course, you need to do this so the results are based on the data in the file, even if the data changes, so you need to extract the information as was done in Week6 to put it in the title. My code is as below: %let dirdata=/folders/myfolders;
libname perm "&dirdata";
data perm.profits;
set profits "&dirdata";
proc print data=perm.profits;
run;
data profitsA;
retain sumP;
set perm.profits end=eof;
if _n_=1 then do;
call symput('y1',year);
call symput('q1',qtr);
end;
sumP+profit;
VARVAL=COMPRESS('q1',S);
if eof then do;
call symput('y2',year);
call symput('q2',qtr);
VARVAL=COMPRESS('q2',S);
call symput('sumProfit',sumP);
sumPNice=put(sumP,dollar7.);
call symput('sumProfitNice',sumPNice);
thisDay=put(date(),worddate18.);
call symput('tdDate1',thisDay);
end;
run;
title "Based on data from Q&q1 &y1 to Q&q2 &y2:";
title2 "Total profits are &sumProfitNice.. Great work, everyone!";
title3 "Report produced &tdDate1 (%sysfunc(date(),mmddyy8.)).";
proc print data=profitsA;
title;
run; LOG: 1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
2 TITLE;
3 FOOTNOTE;
4 OPTIONS LOCALE=en_US DFLANG=LOCALE;
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
5 DATA _NULL_;
6 RUN;
7 OPTIONS VALIDVARNAME=V7;
8 OPTIONS VALIDMEMNAME=COMPAT;
9 FILENAME _HTMLOUT TEMP;
10 FILENAME _RTFOUT TEMP ENCODING='UTF-8';
11 FILENAME _PDFOUT TEMP;
12 FILENAME _GSFNAME TEMP;
13 FILENAME _DATAOUT TEMP;
14 %LET SYSCC=0;
15 %LET _CLIENTAPP='SAS Studio';
16 %LET _CLIENTAPPABREV=Studio;
17 %LET _CLIENTAPPVERSION=3.7;
18 %LET _CLIENTVERSION=3.7;
19 %LET _CLIENTMODE=basic;
20 %LET _SASSERVERNAME=%BQUOTE(localhost);
21 %LET _SASHOSTNAME=%BQUOTE(localhost);
22 %LET _SASPROGRAMFILEHOST=%BQUOTE(localhost);
23 %LET _CLIENTUSERID=%BQUOTE(sasdemo);
24 %LET _CLIENTUSERNAME=%BQUOTE(sasdemo);
25 %LET CLIENTMACHINE=%BQUOTE(10.0.2.2);
26 %LET _CLIENTMACHINE=%BQUOTE(10.0.2.2);
27 %let SASWORKLOCATION="%sysfunc(getoption(work))/";
28 FILENAME _CWD '.';
29 DATA _NULL_;
30 CALL SYMPUT('_SASWORKINGDIR',PATHNAME('_CWD'));
31 RUN;
32 FILENAME _CWD;
33
34 %LET _SASPROGRAMFILE = %NRQUOTE(%NRSTR(/folders/myfolders/Programs/Week_6/ChenJenli_jc3992_Assignment5.sas));
35 %LET _BASEURL = %BQUOTE(http://localhost:10080/SASStudio/);
36 %LET _EXECENV=SASStudio;
______________________________________________________________________________________________________________________
49
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space
between a quoted string and the succeeding identifier is recommended.
37 DATA _NULL_;
38 CALL
38 ! SYMPUT("GRAPHINIT"
_
49
38 ! ,"");
39 CALL
39 ! SYMPUT("GRAPHTERM"
_
49
39 ! ,"");
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space
between a quoted string and the succeeding identifier is recommended.
40 RC=TSLVL('GEOCODE','N');
41 _ERROR_=0;
42 IF (RC^=' ') THEN DO;
43 CALL SYMPUT("GRAPHINIT","GOPTIONS RESET=ALL GSFNAME=_GSFNAME;");
___ ________________
49 49
44 CALL SYMPUT("GRAPHTERM","GOPTIONS NOACCESSIBLE;");
___ ___________________________________
49 49
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space
between a quoted string and the succeeding identifier is recommended.
45 END;
46 RUN;
47 DATA _NULL_;
48 RC=SYSPROD("PRODNUM002"
_
49
48 ! );
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space
between a quoted string and the succeeding identifier is recommended.
49 IF (RC^=1) THEN DO;
50 CALL
50 ! SYMPUT("GRAPHINIT"
_
49
50 ! ,"");
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space
between a quoted string and the succeeding identifier is recommended.
51 CALL SYMPUT("GRAPHTERM","");
52 END;
53 RUN;
54 %LET _DATAOUT_MIME_TYPE=;
55 %LET _DATAOUT_NAME=;
56 %LET _DATAOUT_TABLE=;
57 %LET _DATAOUT_URL=;
58 %SYMDEL _DATAOUT_MIME_TYPE _DATAOUT_NAME _DATAOUT_URL _DATAOUT_TABLE;
59 %LET _SASWS_ = %BQUOTE(/folders/myfolders);
60 %LET _SASWSTEMP_=%BQUOTE(/folders/myfolders/.sasstudio/.images/09859bac-b10d-4435-a5a2-dd2a3120cdc0);
61 ODS LISTING CLOSE;
62 ODS AUTONAVIGATE OFF;
63 ODS GRAPHICS ON;
64 ODS HTML5 (ID=WEB) DEVICE=PNG GPATH="&_SASWSTEMP_" ENCODING=utf8 FILE=_HTMLOUT (TITLE='Results:
64 ! ChenJenli_jc3992_Assignment5.sas') STYLE=Htmlblue OPTIONS(BITMAP_MODE='INLINE' OUTLINE='ON' SVG_MODE='INLINE'
64 ! CSS_PREFIX='.ods_09859bac-b10d-4435-a5a2-dd2a3120cdc0' BODY_ID='div_09859bac-b10d-4435-a5a2-dd2a3120cdc0' );
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
65 ODS RTF (ID=WEB) STYLE=Rtf FILE=_RTFOUT sasdate;
66 ODS PDF (ID=WEB) STYLE=Pearl FILE=_PDFOUT;
67 &GRAPHINIT;
68 OPTIONS FIRSTOBS=1;
69 OPTIONS OBS=MAX;
70 OPTIONS DTRESET DATE NUMBER NOTES;
71 OPTIONS NOTES STIMER SOURCE NOSYNTAXCHECK;
72
73 %let dirdata=/folders/myfolders;
74 libname perm "&dirdata";
75
76 data perm.profits;
77 set profits "&dirdata";
78 proc print data=perm.profits;
79 run;
80
81 data profitsA;
82 retain sumP;
83 set perm.profits end=eof;
84 if _n_=1 then do;
85 call symput('y1',year);
86 call symput('q1',qtr);
87 end;
88 sumP+profit;
89 VARVAL=COMPRESS('q1',S);
90 if eof then do;
91 call symput('y2',year);
92 call symput('q2',qtr);
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
93 VARVAL=COMPRESS('q2',S);
94 call symput('sumProfit',sumP);
95 sumPNice=put(sumP,dollar7.);
96 call symput('sumProfitNice',sumPNice);
97 thisDay=put(date(),worddate18.);
98 call symput('tdDate1',thisDay);
99 end;
100 run;
101
102 title "Based on data from Q&q1 &y1 to Q&q2 &y2:";
103 title2 "Total profits are &sumProfitNice.. Great work, everyone!"
__________
49
103 ! ;
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space
between a quoted string and the succeeding identifier is recommended.
104 title3 "Report produced &tdDate1 (%sysfunc(date(),mmddyy8.)).";
105
106 proc print data=profitsA;
107 title;
108 run;
109
110 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
111 ODS HTML CLOSE;
112 &GRAPHTERM; ;*';*";*/;RUN;QUIT;
113 QUIT;RUN;
114 ODS HTML5 (ID=WEB) CLOSE;
115
116 ODS RTF (ID=WEB) CLOSE;
117 ODS PDF (ID=WEB) CLOSE;
118 FILENAME _GSFNAME;
119 DATA _NULL_;
120 RUN;
121 OPTIONS VALIDMEMNAME=COMPAT;
122 OPTIONS NOTES STIMER SOURCE SYNTAXCHECK;
123
User: sasdemo No output at all.Any ideas?
... View more