BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello everyone:

I have a trouble when dealing with format.
Here is a example:

data trial;
input id age grade;
cards;
1 23 1
2 39 1
3 45 4
4 56 10
5 67 2
6 78 11
7 89 12
;
proc format;
value agefmt 0-<20=A
21-<30=B
31-<40=C
41-<50=D
51-<60=E
61-<70=F
71-<80=G
81-<90=H;
value grafmt 1-6=J
7-9=S
10-12=H;
run;

proc tabulate data=trial;
class age grade;
tables age,grade;
format age agefmt. grade grafmt. ;
run;

I would like to produce a table, which row and column are composed by values of format agefmt and grafmt, but this

program ignores missing values for format.
How can I produce table like this :
J S H
A
B
C
D
E
F
G
H

Thank you in advance. 🙂
7 REPLIES 7
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You will want to review this post, before re-posting your code:

http://support.sas.com/forums/thread.jspa?messageID=27609


Scott Barry
SBBWorks, Inc.
Ksharp
Super User
Hi. you do not say something about your error .
and what do your log look like?

proc format;
value agefmt 0-<20= ??????? ; you also give nothing information.
deleted_user
Not applicable
sorry, I haven't notice that there is a limit in line of one topic.

I need a report which column and row are consisted by all values defined in format procedure previously, but there are some missing values for several values of format, so in report generated by tabulate procedure or freq procedure, some columns and rows I demanded will be missing. How can I get the result I need?

Thank you in advance. 🙂
Patrick
Opal | Level 21
The issue is not a line limitation but that certain character combinations are interpreted as HTML code instead of content (that's the link Scott pointed you to).

As for your question.
I have to guess a bit as not your full post made it to this forum but you might be interested in investigating the options "missing" or "CLASSDATA=" for Proc Tabulate ( http://support.sas.com/onlinedoc/913/getDoc/en/proc.hlp/a002473736.htm#a003069171 )

HTH
Patrick
Cynthia_sas
SAS Super FREQ
Your ability to post code will be greatly enhanced if you read the forum posting that Scott referenced. Any code with < or > must be treated specially for posting so it does not conflict with the HTML used to maintain the forum. That's what Scott's article talks about -- how to protect those special characters and how to post code snippets.

In addition, these previous forum postings and Tech Support notes discuss the use of PRELOADFMT with PROC TABULATE to account for the appearance of CLASS variables in the table, even if the values themselves do not appear in the data.

http://support.sas.com/forums/thread.jspa?messageID=19957䷵
http://support.sas.com/forums/thread.jspa?messageID=14459㡻
http://support.sas.com/forums/thread.jspa?messageID=4872ገ
http://support.sas.com/forums/thread.jspa?messageID=17685䔕
http://support.sas.com/kb/25/101.html
http://support.sas.com/kb/25/400.html
http://support.sas.com/kb/25/403.html
http://support.sas.com/kb/23/846.html

cynthia
deleted_user
Not applicable
Thank you, Cynthia, Krasharp and everyone. SAS and this forum are really fresh for me, and the history topics are quite useful.
Ksharp
Super User
[pre]
proc freq data=sashelp.class;
tables name /missing;
format name fmt.;
run;
[/pre]

[pre]
proc tabulate data=sashelp.class;
class name /preloadfmt;
table name/printmiss;
format name fmt.;
run;
[/pre]


Ksharp Message was edited by: Ksharp

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
  • 7 replies
  • 1206 views
  • 0 likes
  • 5 in conversation