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
York | 3 |
GR | 4 |
York | 38 |
Puddle | 2 |
- output when VARTYPE not used in proc print
York | A | 3 |
GR | A | 4 |
York | B | 38 |
Puddle | A | 2 |
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)
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.
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.
Glad to be at service 🙂
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!
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.