Desktop productivity for business analysts and programmers

Variable in Title

Reply
N/A
Posts: 0

Variable in Title

I have having a hard time getting variable data in to the title and the n=
I am using the #BYVAR for one part and that is working fine but when I try to use the symput to get the value from another column in the data I am only getting a "."
Can you look at my code and tell me what I am doing wrong?

Code generated by SAS Task

Generated on: Monday, January 21, 2008 at 11:57:11 AM
By task: List Data

Input Data: WORK.CUR_PREV_LIB_STUDIES
Server: SASMain
------------------------------------------------------------------- */


/* Start of custom user code. */
options nobyline;




/* End of custom user code. */
PROC SQL;
%_SASTASK_DROPDS(WORK.SORTTempTableSorted);
QUIT;

/* -------------------------------------------------------------------
Data set WORK.CUR_PREV_LIB_STUDIES does not need to be sorted.
------------------------------------------------------------------- */
PROC SQL;
CREATE VIEW WORK.SORTTempTableSorted
AS SELECT Dept_Course, MscTitle1, SUM_OF_MscMaxSeats, SUM_OF_MscTotalEnrolled1, SUM_OF_MscMaxSeats1, SUM_OF_MscTotalEnrolled, "Seats Remaining"n, Difference, Comment, SemDescrip1, SemDescrip, Group FROM WORK.CUR_PREV_LIB_STUDIES;
QUIT;
TITLE;
TITLE1 "Liberal Studies Maximum Seating Comparison";
TITLE2 "#byval(group)";
TITLE3 "#byval(semdescrip) VS #byval(semdescrip1)";
TITLE4 "%SYSFUNC(DATE(), WORDDATE32.) at %SYSFUNC(TIME(), TIMEAMPM8.);";
FOOTNOTE;

/* Start of custom user code. */
DATA _NULL_;
if _N_ = 1 then
call symput("PrevSemester", "Spring 2007");
if _N_ = 1 then
call symput("CurSemester", "Spring 2008");
if _N_ = 1 then
call symput("Lib_Group", put(group, best.));
else stop;
/* End of custom user code. */

PROC PRINT DATA=WORK.SORTTempTableSorted
NOOBS
LABEL
SPLIT='*'

/* Start of custom user code. */
n="TOTAL Classes for this &lib_Group = "
style(total)={background=yellow}
/* End of custom user code. */
;
VAR Dept_Course MscTitle1 SUM_OF_MscMaxSeats SUM_OF_MscTotalEnrolled1 SUM_OF_MscMaxSeats1 SUM_OF_MscTotalEnrolled "Seats Remaining"n Difference Comment SemDescrip1 SemDescrip
/* Start of custom user code. */
/ STYLE= {Foreground=bigdiff.}
/* End of custom user code. */

;
BY Group NOTSORTED;
SUMBY Group;
LABEL Dept_Course="DEPT*COURSE_NO"
MscTitle1="_____COURSE_TITLE_____"
SUM_OF_MscMaxSeats="PREV_SEM*MAX_SEATS"
SUM_OF_MscTotalEnrolled1="PREV_SEM*TOTAL_REG"
SUM_OF_MscMaxSeats1="CUR_SEM*MAX_SEATS"
SUM_OF_MscTotalEnrolled="CUR_SEM*TOTAL_REG"
"Seats Remaining"n="SEATS*REMAIN";
RUN;
/* -------------------------------------------------------------------
End of task code.
------------------------------------------------------------------- */
RUN; QUIT;
PROC SQL;
%_SASTASK_DROPDS(WORK.SORTTempTableSorted);
QUIT;

TITLE; FOOTNOTE;
Frequent Contributor
Posts: 81

Re: Variable in Title

Cheri,

Add the following line after DATA _NULL_, as you had no input data set:

SET WORK.SORTTempTableSorted;

and the following line (not required, but it makes the code easier to read!) before PROC PRINT:

RUN;

You should get something next time............Phil
N/A
Posts: 0

Re: Variable in Title

THANK YOU!
SAS Super FREQ
Posts: 8,819

Re: Variable in Title

Is the code being restricted to just one GROUP??? This will work for ALL values of GROUP:
[pre]
TITLE2 "#byval(group)";
[/pre]

but this: [pre]
if _N_ = 1 then
call symput("Lib_Group", put(group, best.));
[/pre]
will only work for the 1st value for GROUP on the 1st observation??

Or is there only 1 value for GROUP??

cynthia
Ask a Question
Discussion stats
  • 3 replies
  • 153 views
  • 0 likes
  • 3 in conversation