BookmarkSubscribeRSS Feed
PGStats
Opal | Level 21

Hi,

Can somebody tell me what happens to my percent character in the column title produced by:
 
data test; x=0.1; run;

ods rtf file="&sasforum.\Reports\test percent.rtf" style=journal;


proc sql;
select x label='% Detected' format=percentn7.1
from test;
quit;

 
ods rtf close;

Percent Column Title.PNG

PG

PG
2 REPLIES 2
ballardw
Super User

Don't know why the RTF generator eats it but try '\% Detected'. I think the \ acts as an RTF escape character.

My guess is the % at the start of a string indicates some kind of predicate or code otherwise.

PGStats
Opal | Level 21

Thanks , I finally found it in the Doc. I thought that you could use anything as a label in SQL. Not so! There are rules:

A label can begin with the following characters: a through z, A through Z, 0 through 9, an underscore (_), or a blank space. If you begin a label with any other character, such as pound sign (#), then that character is used as a split character and it splits the label onto the next line wherever it appears. For example: select dropout label= '#Percentage of#Students Who#Dropped Out' from educ(obs=5);

If a special character must appear as the first character in the output, then precede it with a space or a forward slash (/).

So, my percent sign was used as a split character, which is why it was ignored.

PG

PG

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2 replies
  • 1036 views
  • 0 likes
  • 2 in conversation