BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I heve a proc sql to make a sasdataset called result.
The dataset contains a variable amount wich has a format of commax13.2

I want to sort the dataset and give the variable amount an format of z11.
proc sort data=userdata.result;
by xxx;
FORMAT amount z11. ;
run;
But the format stays commax13.2

I also use a proc export:
PROC EXPORT DATA=userdata.result
OUTFILE = 'Q:\bla\bla\xx.txt'
DBMS = dlm
REPLACE ;
FORMAT amount z11. ;
RUN ;
But the format stays commax13.2

So the question is why doesn't it work, does the format statement only have effect when creating a new dataset?
2 REPLIES 2
LinusH
Tourmaline | Level 20
I did a small test on SASHELP.class, and it works for me:

proc copy in=sashelp out=work;
select class;
run;

proc sort data=class;
by age;
format age z11.;
run;

proc print;
run;

Obs Name Sex Age Height Weight
1 Joyce F 00000000011 51.3 50.5
2 Thomas M 00000000011 57.5 85.0
3 James M 00000000012 57.3 83.0
4 Jane F 00000000012 59.8 84.5
...

Please attach full log and partial output from your example.
/Linus
Data never sleeps
deleted_user
Not applicable
Thanks for your anwser, i did some further checking

The format didn't work on the proc sort because the dataset was already sorted in the right way, so no sorting was done and no reformating.

why the format didn't work with proc export i'm still checking.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 771 views
  • 0 likes
  • 2 in conversation