BookmarkSubscribeRSS Feed
anirudhs
Obsidian | Level 7
Team following code is not giving any output on sas viya but the code is working is working in sas 9.4 but when executed on viya its showing only note as you may have missed a quoted string or its 256 char long no error :
PROC REPORT DATA=demo.Rural_Sales_MASTER_CORE_ZONE MISSING

style(report) = {just=center borderwidth=0.5 font = ('zurich BT',12PT) bordercolor = black}

style(header) = {foreground = WHITE background =maroon font = ('zurich BT',12PT) fontweight = bold bordercolor =black}

style(column) = {just=left foreground = black borderwidth = 0.5 borderstyle=solid bordercolor = black};

/*WHERE ZONE IN ('Zone SW','Zone NE');*/

COLUMN ZONE 'FTD(#)'n 'MTD(#)'n 'Target Accounts'n 'SDLM(#)'n 'FTD(Cr.)'n 'MTD(Cr.)'n 'Target Amount'n 'SDLM(Cr.)'n ;

DEFINE ZONE/GROUP;

define 'Target Accounts'n/"Plan(#)";

define 'Target Amount'n/"Plan (Cr.)";

RBREAK AFTER / SUMMARIZE ;

COMPUTE ZONE;

IF _BREAK_ ="_RBREAK_" THEN DO ZONE ='Total' ;

CALL DEFINE(_ROW_,"STYLE","STYLE={FOREGROUND = WHITE BACKGROUND = MAROON FONT = ('ZURICH BT',12PT) FONTWEIGHT = BOLD}");

END;

ENDCOMP;



RUN;
10 REPLIES 10
Kurt_Bremser
Super User

Please post the whole log of the proc report into a window opened with the {i} button.

 

BTW, I recommend to get rid of these stupid variable names three years before yesterday. Such fancy strings belong in labels, that's why labels exist.

ballardw
Super User

@anirudhs wrote:
Team following code is not giving any output on sas viya but the code is working is working in sas 9.4 but when executed on viya its showing only note as you may have missed a quoted string or its 256 char long no error :
PROC REPORT DATA=demo.Rural_Sales_MASTER_CORE_ZONE MISSING

style(report) = {just=center borderwidth=0.5 font = ('zurich BT',12PT) bordercolor = black}

style(header) = {foreground = WHITE background =maroon font = ('zurich BT',12PT) fontweight = bold bordercolor =black}

style(column) = {just=left foreground = black borderwidth = 0.5 borderstyle=solid bordercolor = black};

/*WHERE ZONE IN ('Zone SW','Zone NE');*/

COLUMN ZONE 'FTD(#)'n 'MTD(#)'n 'Target Accounts'n 'SDLM(#)'n 'FTD(Cr.)'n 'MTD(Cr.)'n 'Target Amount'n 'SDLM(Cr.)'n ;

DEFINE ZONE/GROUP;

define 'Target Accounts'n/"Plan(#)";

define 'Target Amount'n/"Plan (Cr.)";

RBREAK AFTER / SUMMARIZE ;

COMPUTE ZONE;

IF _BREAK_ ="_RBREAK_" THEN DO ZONE ='Total' ;

CALL DEFINE(_ROW_,"STYLE","STYLE={FOREGROUND = WHITE BACKGROUND = MAROON FONT = ('ZURICH BT',12PT) FONTWEIGHT = BOLD}");

END;

ENDCOMP;



RUN;

Doesn't work is awful vague.

Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.

No output? Post any log in a code box.

Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

anirudhs
Obsidian | Level 7
Log {

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
76
77 libname demo '/IT/Rural_Portfolio_Summary/Branch_Summary';
NOTE: Libref DEMO was successfully assigned as follows:
Engine: V9
Physical Name: /IT/Rural_Portfolio_Summary/Branch_Summary
78
79 proc sort data=demo.Rural_Sales_MASTER_COmbo out=demo.Rural_Sales_MASTER_CORE_ZONE;
80 by Zone;
81 run;
NOTE: There were 919 observations read from the data set DEMO.RURAL_SALES_MASTER_COMBO.
NOTE: The data set DEMO.RURAL_SALES_MASTER_CORE_ZONE has 919 observations and 25 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.07 seconds
cpu time 0.00 seconds

82 /*----------------ZONE WISE -------------------------------*/
83
84 DATA _NULL_;
85 Call SymputX('Datetime',put(datetime(),datetime.));
86 run;
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

87
88 options emailsys=SMTP;
89 options emailhost=CFLMUMCASHUB02.kiac.in;
90 options emailport=25;
91
92 ODS _ALL_ CLOSE;
93 filename mailbox email
94
95 TO=
96 (
97 'anirudh.saawaant@idfcfirstbank.com',
98 'sachin.thakur@idfcfirstbank.com'
99 )
100 type='text/html'
101 subject="Rural Sales Summary Zone Wise";
102 ods html file=mailbox rs=none ;
NOTE: Writing HTML Body file: MAILBOX
103 OPTIONS MISSING=0;
104 PROC ODSTEXT;
105 P "Dear All,";
106 p " ";
107 P "Please find Rural Sales Summary Zone Wise As on &Datetime" ;
108 RUN;
NOTE: PROCEDURE ODSTEXT used (Total process time):
real time 0.05 seconds
cpu time 0.02 seconds

109 ODS LAYOUT START COLUMNS=1 WIDTH=14.0IN HEIGHT=4.0IN;
110 ODS REGION;
111
112 /*------- CONSOLIDATE ZONE WISE REPORT ----------*/
113
114 PROC REPORT DATA=demo.Rural_Sales_MASTER_CORE_ZONE MISSING
115 style(report) = {just=center borderwidth=0.5 font = ('zurich BT',12PT) bordercolor = black}
116 style(header) = {foreground = WHITE background =maroon font = ('zurich BT',12PT) fontweight = bold bordercolor =black}
117 style(column) = {just=left foreground = black borderwidth = 0.5 borderstyle=solid bordercolor = black};
118 /*WHERE ZONE IN ('Zone SW','Zone NE');*/
119 COLUMN ZONE 'FTD(#)'n 'MTD(#)'n 'Target Accounts'n 'SDLM(#)'n 'FTD(Cr.)'n 'MTD(Cr.)'n 'Target Amount'n 'SDLM(Cr.)'n ;
120 DEFINE ZONE/GROUP;
121 /* define 'FTD(#)'n/"FTD_#"; */
122 define 'Target Accounts'n/"Plan(#)";
123 define 'Target Amount'n/"Plan (Cr.)";
124 RBREAK AFTER / SUMMARIZE ;
125 COMPUTE ZONE;
126 IF _BREAK_ ="_RBREAK_" THEN DO ZONE ='Total' ;
127 CALL DEFINE(_ROW_,"STYLE","STYLE={FOREGROUND = WHITE BACKGROUND = MAROON FONT = ('ZURICH BT',12PT) FONTWEIGHT = BOLD}");
128 END;
129 ENDCOMP;
130
131 RUN;
NOTE: There were 919 observations read from the data set DEMO.RURAL_SALES_MASTER_CORE_ZONE.
NOTE: PROCEDURE REPORT used (Total process time):
real time 0.07 seconds
cpu time 0.05 seconds

132
133 PROC REPORT DATA=demo.Rural_Sales_MASTER_CORE_ZONE
134 style(report) = {just=center borderwidth=0.5 font = ('zurich BT',12PT) bordercolor = black}
135 style(header) = {foreground = white background = maroon font = ('zurich BT',12PT) fontweight = bold bordercolor =black}
136 style(column) = {just=left foreground = black borderwidth = 0.5 borderstyle=solid bordercolor = black};
137 /*col _all_;*/
138 COLUMN ZONE STATE 'FTD(#)'n 'MTD(#)'n 'Target Accounts'n 'SDLM(#)'n 'FTD(Cr.)'n 'MTD(Cr.)'n 'Target Amount'n 'SDLM(Cr.)'n ;
139 DEFINE ZONE/GROUP;
140 define 'Target Accounts'n/"Plan(#)";
141 define 'Target Amount'n/"Plan (Cr.)";
142 define state/group;
143
144 RBREAK AFTER / SUMMARIZE ;
145 COMPUTE STATE;
146 IF _BREAK_ ="_RBREAK_" THEN DO STATE ='Total' ;
147 CALL DEFINE(_ROW_,"STYLE","STYLE={FOREGROUND = WHITE BACKGROUND = MAROON FONT = ('ZURICH BT',12PT) FONTWEIGHT = BOLD}");
148 END;
149 ENDCOMP;
150 run;
NOTE: There were 919 observations read from the data set DEMO.RURAL_SALES_MASTER_CORE_ZONE.
NOTE: PROCEDURE REPORT used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds

151
152 /*ZONE WISE PRODUCT BIFERCATION */
153 PROC REPORT DATA=demo.Rural_Sales_MASTER_CORE_ZONE
154 style(report) = {just=center borderwidth=0.5 font = ('zurich BT',12PT) bordercolor = black}
155 style(header) = {foreground = white background = maroon font = ('zurich BT',12PT) fontweight = bold bordercolor =black}
156 style(column) = {just=left foreground = black borderwidth = 0.5 borderstyle=solid bordercolor = black};
157 /*col _all_;*/
158 COLUMN ZONE PRODUCT 'FTD(#)'n 'MTD(#)'n 'Target Accounts'n 'SDLM(#)'n 'FTD(Cr.)'n 'MTD(Cr.)'n 'Target Amount'n 'SDLM(Cr.)'n ;
159 define ZONE/group;
160 define 'Target Accounts'n/'Plan(#)';
161 define 'Target Amount'n/'Plan (Cr.)';
162 define product/group;
163 BY ZONE;
164
165 RBREAK AFTER / SUMMARIZE ;
166 COMPUTE PRODUCT;
167 IF _BREAK_ ="_RBREAK_" THEN DO PRODUCT ='Total' ;
168 CALL DEFINE(_ROW_,"STYLE","STYLE={FOREGROUND = WHITE BACKGROUND = MAROON FONT = ('ZURICH BT',12PT) FONTWEIGHT = BOLD}");
169 END;
170 ENDCOMP;
171 RUN;
NOTE: There were 919 observations read from the data set DEMO.RURAL_SALES_MASTER_CORE_ZONE.
NOTE: PROCEDURE REPORT used (Total process time):
real time 0.10 seconds
cpu time 0.11 seconds

172
173 ODS LAYOUT END;
174 ODS HTML CLOSE;
ERROR: Email server did not respond.
175 FILENAME MAILBOX CLEAR;
NOTE: Fileref MAILBOX has been deassigned.
176 ODS _ALL_ CLOSE;
177
178 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
191

}
anirudhs
Obsidian | Level 7
When manually run it send the mail with the report in it, but when scheduled it give an error of FTD(#) not a valid name.

As the above log attached is of the code when manually run.
Please ignore the error of Email server not responding
Kurt_Bremser
Super User

Your batch job is running with SAS system option validvarname=v7 (which makes a lot of sense IMO).

As I already said, get rid of those stupid variable names three years before yesterday.

anirudhs
Obsidian | Level 7
Hi Kurt actually we cannot get rid of the variable names as its the requirement of the client as they are in habbitual of these names as per the indian banking names.
Any other way out
Kurt_Bremser
Super User

@anirudhs wrote:
Hi Kurt actually we cannot get rid of the variable names as its the requirement of the client as they are in habbitual of these names as per the indian banking names.
Any other way out

IMO that's a non-argument. Fancy names can be stored in labels and retrieved from there when you export to other formats (csv, Excel).

They are not needed within SAS and only cause trouble.

As a consultant, it is also your job to show your client where they do not work efficiently.

 

But if you still want to keep hurting yourself, use

options validvarname=any;

before running this code.

anirudhs
Obsidian | Level 7
Hi Kurt , the issue is that when submitting the code manually its working perfectly but tis not resolving when in scheduler and the options command is also not working in scheduler
Patrick
Opal | Level 21

@anirudhs wrote:
Hi Kurt , the issue is that when submitting the code manually its working perfectly but tis not resolving when in scheduler and the options command is also not working in scheduler

That doesn't make sense. Code issued manually and via batch might get a different environment (different config and autoexec files) which could explain what you observe. But any option set directly in your program code will overwrite what's set in the environment config as default.

If this is about variable names then add options VALIDVARNAME=ANY; at the beginning of your code.

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 10 replies
  • 1484 views
  • 3 likes
  • 4 in conversation