BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mano
Calcite | Level 5

Hello all,

Here is my proc report:-

Proc report data=final split='|" headline headlskip;

   columns col1-col3;

define col1 / display "AESOC| reported term" width=60 flow;

define col2 / display "test drug | (N=&n1)" width=25;

define col3 / display "reference drug | (N=&n2)" width=25;

run;

In the column headers of my output, I see leading spaces present for the population count as follows:-

__________________________________________________________

AESOC                                  test drug                   reference drug

reported term                       (N=      188)                  (N=       88)

___________________________________________________________

I have no idea why there are leading spaces.Can any suggest what might be causing the problem.

my code for populatin count is:-

proc sql noprint;

   select count(distinct usubjid) into : n1 from adsl where saffl eq "Y" and trta eq "test";

   select count(distinct usubjid) into : n2 from adsl where saffl eq "Y" and trta eq "Ref";

quit;

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi, generally, you do sometimes need to strip leading spaces from a macro variable. The simplest way to do that is:

%let n1=&n1;

%let n2=&n2;

AFTER the quit in your SQL step. (There are other ways to trim the spaces, but that is the simplest that will work in all versions of SAS.)

cynthia

View solution in original post

1 REPLY 1
Cynthia_sas
SAS Super FREQ

Hi, generally, you do sometimes need to strip leading spaces from a macro variable. The simplest way to do that is:

%let n1=&n1;

%let n2=&n2;

AFTER the quit in your SQL step. (There are other ways to trim the spaces, but that is the simplest that will work in all versions of SAS.)

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 639 views
  • 0 likes
  • 2 in conversation