New SAS User

Completely new to SAS or trying something new with SAS? Post here for help getting started.
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jranta
Calcite | Level 5

I know there has to be a simple solution here. It prints out everything I want except for the values. 

proc format;
value id = 'ID';
value Diagnosis 0 = 'n/a' 
				1 = 'LTBI'
    			2 = 'ACTIVE' 
				3 = 'NOT TB';
value PPD 		0 = 'n/a' 
				1= 'Positive' 
				2= 'Negative';
value CXR 		0 = 'n/a' 
				1 = 'WNL' 
				2 = 'Abnormal';
value Treatment 0 = 'n/a' 
				1 = 'Yes' 
				2 = 'No' 
				3 = 'Pending';
				run;
Data Notes;
input ID Diagnosis PPD CXR Treatment;
datalines;
1 1 1 1 1
2 1 1 1 1
3 1 1 1 1
4 1 1 1 1
5 2 1 2 2
6 1 1 1 1
7 1 1 1 1
8 0 0 0 0
9 1 1 1 1
10 1 1 1 1
11 2 1 2 2
12 1 2 0 0
13 3 2 0 0
14 3 2 0 0
15 3 2 0 0
16 2 1 2 2
17 1 1 1 1
18 3 2 0 0
19 3 2 0 0
20 1 1 1 1
21 1 1 1 1
22 3 2 0 1
23 1 1 1 0
24 3 2 0 1
25 3 2 0 0
26 1 1 1 0
27 3 2 0 1
28 3 2 0 0
29 3 2 0 0
30 3 2 0 0
31 3 2 0 0
32 2 1 2 3
33 3 2 0 0
34 1 1 1 3
35 2 1 2 2
36 0 0 0 0
37 3 2 0 0
38 3 2 0 0
;
run;
format id id. diagnosis diagnosis. ppd ppd. cxr cxr. treatment treatment.;
proc print data = notes;
var diagnosis ppd cxr treatment;
title 'Chart';
run;
1 ACCEPTED SOLUTION

Accepted Solutions
andreas_lds
Jade | Level 19

The format-statement is misplaced, move it into proc print.

View solution in original post

3 REPLIES 3
Shmuel
Garnet | Level 18

You can show the value as its meaning by using next formats:

proc format;
value id = 'ID';
value Diagnosis 0 = '(0) n/a' 
				1 = '(1) LTBI'
    			2 = '(2) ACTIVE' 
				3 = '(3) NOT TB';
value PPD 		0 = '(0) n/a' 
				1 = '(1) Positive' 
				2 = '(2) Negative';
value CXR 		0 = '(0) n/a' 
				1 = '(1) WNL' 
				2 = '(2) Abnormal';
value Treatment 0 = '(0) n/a' 
				1 = '(1) Yes' 
				2 = '(2) No' 
				3 = '(3) Pending';
run;
andreas_lds
Jade | Level 19

The format-statement is misplaced, move it into proc print.

jranta
Calcite | Level 5

I thought I tried that before, but moving the format under under proc print was it! Thanks!

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1074 views
  • 3 likes
  • 3 in conversation