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-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!

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.

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
  • 2 replies
  • 599 views
  • 0 likes
  • 2 in conversation