BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sharad_Pujari
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

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

2 REPLIES 2
Astounding
PROC Star

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?

Kurt_Bremser
Super User

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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