Hello everyone and anyone! When you run the below code the display PDF number has space/separation from the title. How do I re-format to the number of characters.
Current view: 'Total Number of Records: 2,020'
Want view: 'Total Number of Records: 2,020'
SAS Code:
ods pdf file="file path to save/Total Count.pdf";
options linesize=max;
proc sql noprint;
select
count(*) as Tot_Cnt format comma10.
into
:Obs
from SASHELP.aacomp
;
quit;
%put NOTE: &Obs;
ods pdf startpage=no;
ods proclabel='Title';
title bold height=22pt color=purple "Total Number of Records: &Obs.";
proc report data=SASHELP.aacomp;
run;
title;
ods pdf close;
Thank you for your support!
Add this after the SQL:
%let obs = &obs.;
A %LET will automatically strip the value.
Current view: 'Total Number of Records: 2,020'
The easiest thing to do is to create this string without the unwanted blanks. If you can't do that, use the COMPBL function.
Add this after the SQL:
%let obs = &obs.;
A %LET will automatically strip the value.
Thank you all for your feedback, I knew it had to be something simple. The %LET did the work.
Thank you again!
Or add the option "trimmed" to the into-clause:
proc sql noprint;
select count(*) as Tot_Cnt format comma10.
into :Obs trimmed
from SASHELP.aacomp
;
quit;
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.