Dear Experts,
I would like to see the indentation appear in the proc format library from the output window. For example I created the format $gen as below where the female value has leading space (indent) and the male value is without the leading space or indent. However when i apply this format to derive a new variable, the variable gets the indentation applied. But when i see the format from proc format library from output window i dont see the indentation(leading space), however indentation appears in the dataset for new variable.
I am working on sas 9.4.
proc format;
value $gen
'F'=' Female'
'M'='Male'
;
run;
data class;
set sashelp.class;
gender=put(sex,$gen.);
run;
Thank you @ballardw, the use of null characters (Alt+255 on the numeric keyboard) while creating the format label worked. Now I am able to get the space displayed for the format in the output window.
SAS will strip the blank , when the string is printed in output. Check the real value by proc format. proc format; value $gen 'F'=' Female' 'M'='Male' ; run; proc format cntlout=xx; select $gen ; run;
By "output window" do you mean the traditional text only based output window or do you mean the ods results? Different output destinations behave differently and sometimes for the same procedures.
The style attibute ASIS will preserve leading space in output for those procedures that allow the option but I believe those are mostly the report procedures Proc Print, Report and Tabulate for actual DATA display. I suspect that Proc Format cannot use that option.
Proc Tabulate has the option INDENT=<a number of spaces> for nested row headings.
You may be able to use null characters (Alt+255 on the numeric keyboard) in the format code. The procedures generally do not consider that character as a "blank" to be removed and forces a display with leading "space".
Of course any ouput going to any destinations with proportional fonts and that format may not align as expected
Thank you @ballardw, the use of null characters (Alt+255 on the numeric keyboard) while creating the format label worked. Now I am able to get the space displayed for the format in the output window.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.