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

I'm using ods tagsets.excelxp to output my results.
Are there any special characters I can add in front of "-Lost-Time" so that "-Lost-Time" appears indented (3-5 spaces is fine) when I output in Excel using proc report?

proc format;
value $oshaf "a_reg"="Reg"
      "b_lost"="-Lost-Time"
      "c_darb"="DARB"
;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  I tried the HTML named entity for non-breaking space with Chevell's code -- just changed the format to:

proc format;
value $oshaf    "a_reg"="Reg"
                "b_lost"='   -Lost-Time'
                "c_darb"="DARB" ;
run;

Where I used the following: & nbsp ; (ampersand-nbsp-semi-colon) without ANY spaces. I am writing it this way so you can see what needs to be typed. I am also attaching a pix of the syntax and a shot of the output. Since this posting mechanism uses HTML, it may "eat" the non-breaking space entity.


Cynthia

Drat! the post ate my ampersand-nbsp; -- without any spaces -- look at the screen shot.


show_nbsp_in_format.png

View solution in original post

7 REPLIES 7
Chevell_sas
SAS Employee

You can use the non breaking space characters to add the space and then use the PROTECTSPACIALCHARS= attribute so that they are not protected.

proc format;
value $oshaf    "a_reg"="Reg"
                        "b_lost"='   -Lost-Time'
                         "c_darb"="DARB" ;
run;

data one;
length a $10.;
  a="a_reg";
  output;
  a="b_lost";
  output;
  a= "c_darb";
  output;
run;

ods tagsets.ExcelXP file="c:\temp.xlml";

proc print style(data)={protectspecialchars=off};
format a $oshaf.;
run;

ods tagsets.ExcelXp close;

gzr2mz39
Quartz | Level 8

Thank you for the protectspecialchars suggestion. However, I'm not sure what is the character(s) needed to create space(s) in Excel? Thank you.

Reeza
Super User

Notice that in Chevell's code he's manually added spaces in his proc format.

proc format;

value $oshaf    "a_reg"="Reg"

                        "b_lost"='   -Lost-Time'

                         "c_darb"="DARB" ;

run;

gzr2mz39
Quartz | Level 8

Yes, I saw that. It doesn't seem to work for me. No space is added.

Cynthia_sas
SAS Super FREQ

Hi:

  I tried the HTML named entity for non-breaking space with Chevell's code -- just changed the format to:

proc format;
value $oshaf    "a_reg"="Reg"
                "b_lost"='   -Lost-Time'
                "c_darb"="DARB" ;
run;

Where I used the following: & nbsp ; (ampersand-nbsp-semi-colon) without ANY spaces. I am writing it this way so you can see what needs to be typed. I am also attaching a pix of the syntax and a shot of the output. Since this posting mechanism uses HTML, it may "eat" the non-breaking space entity.


Cynthia

Drat! the post ate my ampersand-nbsp; -- without any spaces -- look at the screen shot.


show_nbsp_in_format.png

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
  • 7 replies
  • 1906 views
  • 3 likes
  • 4 in conversation