Hello All,
I want to check the data type of a variable within a DATASET. Is there any function to check this?
I meant in other programming like PYTHON, we have type() to check the datatype of variable.
For Example:
DATA test;
empName = 'Rob';
empSal = 2000;
typeOfEmpName = /* need function here that will take empName as an argument and return the type*/
typeOfEmpSal = /* need function here that will take empSal as an argument and return the type*/
RUN;
Thanks,
P Yadaw
Thank you, It returns, C for character and N for numeric datatype.
Here you go:
DATA test;
empName = 'Rob';
empSal = 2000;
typeOfEmpName = vtype(empName); /* need function here that will take empName as an argument and return the type*/
typeOfEmpSal = vtype(empSal); /* need function here that will take empSal as an argument and return the type*/
RUN;
proc print data=test;
run;
The way I normally find functions quickly.
I go to the docu where I've got all functions listed by category like here.
Then I either just search in the browser - for your case here I've just searched with keyword type - or I go to the relevant category and just browse over the descriptions. ...or I know a function name related to what I need, search for this one and then look within the same category if there is something suited.
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.