Hello All,
I am not able to create user define format can you pls check below 2 code and let me know where i am doing mistake.
Proc format;
value typefmt
'PA'='Passenger'
'CA'='Car';
run;
Proc print Data =S.Car;
Format Vehicle_type $typefmt.;
run;
and
Proc format;
Value Newgrp low-175='<175'
175-<200='175-200'
200-High= '>200';
run;
proc Freq data =S.Car;
Format Length Newgrp.;
Table Length;
run;
I have a car sales data set in which one variable is Vehicle_type ( Passenger and Car) i would like to show
'PA'='Passenger'
'CA'='Car'
but after run the following code neither i am getting any error nor format created. Pls help.
Proc format;
value $typefmt
'PA'='Passenger'
'CA'='Car';
run;
Proc print Data =S.Car;
Format Vehicle_type $typefmt.;
run;
When you have a problem, ALWAYS post the log from your code. Use the {i} button for posting logs.
Works for me :
libname S "c:\temp";
data S.car;
input Vehicle_type $;
cards;
PA
CA
;
run;
Proc format;
value $typefmt
'PA'='Passenger'
'CA'='Car';
run;
Proc print Data =S.Car;
Format Vehicle_type $typefmt.;
run;
What does the log indicate ?
What error, post the log part.
Please formulate the question which exact descriptions of hat the issue is, what logs say, test data/required output etc. In the first instance typefmt is missing a $, in the second?
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a000063536.htm
Proc format; Value Newgrp low-175='<175' 175-<200='175-200' 200-High= '>200'; run;
has an issue with 175 being in two groups (and not a multilabel format). From your label text I suspect that you might actually want:
Proc format; Value Newgrp low -< 175='<175' 175 -< 200='175-200' 200 - High= '>200'; run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.