BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jimmychoi
Obsidian | Level 7

Hi, a simple program:

 

data pets;
	input breed $ type $ number;
	datatlines;
	York A 3
	GR A 4
	York B 38
	Puddle A 2
	;
RUN;


proc print data = pets;
vartype breed;
sum number;
run;

 

 

two questions:

1. proc print only displays SOME variables, below is the output (see the difference). When I erase the line with VARTYPE, displays all variables.

- output when VARTYPE used in proc print

York3
GR4
York38
Puddle2

 

- output when VARTYPE not used in proc print

YorkA3
GRA4
YorkB38
PuddleA2

 

2. What does VARTYPE do? I know this would display the 'type' of variable breed, as a character, but what meaning does it have, when declared inside PROC PRINT? so far, from the output, there is no information on the type of variable 'breed'. (as you can see from the table (output) above)

 

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Neither I, now the PROC PRINT SAS Documentation has heard of a VARTYPE Statement in PROC PRINT. What does your log say? When I run this

 

proc print data=sashelp.class;
   vartype sex;
   sum height;
run;

my log gives me the warning: "WARNING 1-322: Assuming the symbol VAR was misspelled as vartype.". I suspect this is also the case here, so use the VAR Statement instead.

View solution in original post

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

Neither I, now the PROC PRINT SAS Documentation has heard of a VARTYPE Statement in PROC PRINT. What does your log say? When I run this

 

proc print data=sashelp.class;
   vartype sex;
   sum height;
run;

my log gives me the warning: "WARNING 1-322: Assuming the symbol VAR was misspelled as vartype.". I suspect this is also the case here, so use the VAR Statement instead.

jimmychoi
Obsidian | Level 7
Thanks, draycut.
I think it is var type breed, instead of vartype bread.
You have enlightened me 🙂

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

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.

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