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.
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.