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 🙂
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.