BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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;
3 REPLIES 3
prholland
Fluorite | Level 6
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
deleted_user
Not applicable
THANK YOU!
Cynthia_sas
SAS Super FREQ
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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 3 replies
  • 762 views
  • 0 likes
  • 3 in conversation