Community talk about communities.sas.com. Meta!

how to extract num and char record to the another dataset in sas.??

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 11
Accepted Solution

how to extract num and char record to the another dataset in sas.??

i have dataset named one and it has many observation and i want to extract num variables into dataset named Number and char variables in Character dataset how to do this please help me out...!!!


Accepted Solutions
Solution
‎07-20-2017 09:58 AM
Super User
Posts: 5,509

Re: how to extract num and char record to the another dataset in sas.??

Posted in reply to Sharad_Pujari

Doing what you ask is easy:

 

data just_nums (keep=_numeric_) just_chars (keep=_character_);

set have;

run;

 

However, you have to realize that this is less than useless.  It is destructive.  Once you have separated them, and there are no common variables in the two data sets, how will you ever put them back together again?  There is no SAS-based reason to do this.  Perhaps there is an academic reason?

View solution in original post


All Replies
Solution
‎07-20-2017 09:58 AM
Super User
Posts: 5,509

Re: how to extract num and char record to the another dataset in sas.??

Posted in reply to Sharad_Pujari

Doing what you ask is easy:

 

data just_nums (keep=_numeric_) just_chars (keep=_character_);

set have;

run;

 

However, you have to realize that this is less than useless.  It is destructive.  Once you have separated them, and there are no common variables in the two data sets, how will you ever put them back together again?  There is no SAS-based reason to do this.  Perhaps there is an academic reason?

Super User
Posts: 7,782

Re: how to extract num and char record to the another dataset in sas.??

Posted in reply to Sharad_Pujari

When you posted your question, you were shown this:

 

Stop right there! Before pressing POST, tick off this checklist. Does your post …

✔ Have a descriptive subject line, i.e., How do I ‘XYZ’? ✔ Use simple language and provide context? Definitely mention what version you’re on. ✔ Include code and example data? Consider using the SAS Syntax feature.

 

 

 

 

 

 

Use simple language. Try to use correct spelling, as many of the non-native-English speakers here will have trouble deciphering Pidgin. This includes proper use of punctuation marks and capitals where necessary.

 

Include the code you already have, and most important, example data. Use the macro provided in https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... to convert your dataset into a data step that can be posted in a code window (6th ({i}) and 7th ("little running man") icons above the main posting window). Also provide the expected result of the intended action.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
☑ This topic is solved.

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

Discussion stats
  • 2 replies
  • 360 views
  • 2 likes
  • 3 in conversation