- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Data in the red circle are latitudes, and I am struggling with adding a degree symbol to every each one of them. Trying to do the job with using the format statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
See if this works for you 🙂
proc format;
picture deg other = '009.999°';
run;
data test;
lat = 42.255; output;
lat = 42.288; output;
format lat deg.;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi @JayhwanLee (and welcome to the SAS Support Communities, btw :-))
If some of your LAT values might be negative (southern latitudes), you should extend the definition of the picture format:
proc format;
picture deg (round)
low - <0 = '0009.999°' (prefix='-')
0 - high = '0009.999°';
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@FreelanceReinh Good catch 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
proc fcmp outlib=work.func.math;
function fmt(x) $;
length w $ 32;
w=cats(' ',x,'(*ESC*){unicode FE12}');
return (w);
endsub;
run;
proc format ;
value fmt
low-high=[fmt()];
run;
options cmplib=work.func;
proc report data=sashelp.class nowd;
format weight height fmt32.;
column _all_;
define _all_/style={cellwidth=80 just=right};
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
how get that Celsius symbol after or between a variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@rogeralfa111 wrote:
how get that Celsius symbol after or between a variable
@rogeralfa111 do not the solutions offered work for you? If not, please explain in detail (really, we need details) and show us the code you have tried.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
proc fcmp outlib=work.func.math;
function fmt(x) $;
length w $ 32;
w=cats(' ',x,'(*ESC*){unicode "2103"x}');
return (w);
endsub;
run;
proc format ;
value fmt
low-high=[fmt()];
run;
options cmplib=work.func;
proc report data=sashelp.class nowd;
format weight height fmt32.;
column _all_;
define _all_/style={cellwidth=80 just=right};
run;
/*Or try this one*/ proc format ; picture xx(default=40) low-high='009.9 ℃'; run; proc report data=sashelp.class nowd; format weight height xx.; column _all_; define _all_/style={cellwidth=80 just=right}; run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
yeah got it
thank you for the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@rogeralfa111 wrote:
how get that Celsius symbol after or between a variable
Custom formats are the way to go with values that you may need for calculation. Once you add some non-digit character like 'C' to an actual value you can no longer us it in arithmetic or model as a continuous variable.
Formats are the instructions SAS uses to display things for humans to read. You can have multiple formats and use the one you need at a specific time.
If you read the Documentation on Proc Format it currently includes an example of how to even do simple numeric conversions, such as degrees F to C at display.