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
Diamond | Level 26
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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1258 views
  • 0 likes
  • 3 in conversation