I am a SAS novice. I have two fields called P_ADJ_INCOME and S_ADJ_INCOME where the output are negative values like: -000680 and I would like to reformat this output to: 00-0680
for reporting purposes.
I would appreciate your help!
If you values are not exactly 6 digits and integer then you will need to provide a larger example of values and how they should appear.
You may also have to provide an example just how you are building your "report".
In both fields, the output is exactly 6 digits including the dash. They all look like this:
-005236
-025450
-003629
Use a picture format:
data have;
do x = -005236,-025450,-003629,-000077;
output;
end;
format x z7.;
run;
proc format;
picture myFormat
low-high='99-9999';
run;
data want;
set have;
y = x;
format y myFormat.;
run;
proc print data=want; run;
Obs. x y 1 -005236 00-5236 2 -025450 02-5450 3 -003629 00-3629 4 -000077 00-0077
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.