DATA Step, Macro, Functions and more

how do we separate numeric variables and character variables from a dataset to other two datasets?

Accepted Solution Solved
Reply
Contributor
Posts: 52
Accepted Solution

how do we separate numeric variables and character variables from a dataset to other two datasets?

How do we separate numeric variables and charcter variables from a dataset to other tow dataset one with numeric and one with character variables?

 


Accepted Solutions
Solution
3 weeks ago
Contributor
Posts: 52

Re: how do we separate numeric variables and character variables from a dataset to other two dataset

Posted in reply to andreas_lds

Thank's...  you written in data step it really helpful.....

View solution in original post


All Replies
Super Contributor
Posts: 345

Re: how do we separate numeric variables and character variables from a dataset to other two dataset

Posted in reply to rajeshalwayswel
I can't imagine any reason to do this, except for using proc iml.

Untested code:
data onlyChar(keep= _character_) onlyNum(keep= _numeric_) ;
set have;
run;

Not sure that _character_ and _numeric_ can be used in this place. If not you have to query sashelp.vcolumn twice and create two macro-variables containing the variable names. Something like
proc sql noprint ;
select name into :charity separated by " "
from sashelp.vcolumn
where memname = upcase("want") and type = "num" ;
Quit;

I am sure you figure out the second select by yourself.
Solution
3 weeks ago
Contributor
Posts: 52

Re: how do we separate numeric variables and character variables from a dataset to other two dataset

Posted in reply to andreas_lds

Thank's...  you written in data step it really helpful.....

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 100 views
  • 0 likes
  • 2 in conversation