How to create new observations based on the value of a observation

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 16
Accepted Solution

How to create new observations based on the value of a observation

Hi,

 

I have a dataset in the following way and interested in creating a new dataset with observations imputed based on the value from input dataset.

 

have_Source_variable

raw.ae1 raw.ae2 raw.ae3 raw.ae4
raw.lb1 raw.lb2 raw.lb3
raw.ex1 raw.ex2

 

 

want_new_variable

raw.ae1

raw.ae2

raw.ae3

raw.ae4
raw.lb1

raw.lb2

raw.lb3
raw.ex1

raw.ex2

 

 

Thank You.


Accepted Solutions
Solution
‎09-28-2015 02:03 PM
Super User
Posts: 17,829

Re: How to create new observations based on the value of a observation

Similar as this question, except your delimiter is a space. The SCAN() function default delimiter is a space so remove the comma as the delimiter option and it should work for you as well.

https://communities.sas.com/t5/General-SAS-Programming/I-have-multiple-data-in-one-column-separated-...

View solution in original post


All Replies
Super User
Posts: 17,829

Re: How to create new observations based on the value of a observation

I have no idea what you're asking...
Occasional Contributor
Posts: 16

Re: How to create new observations based on the value of a observation

I have a variable with values like 

 

variable1

"raw.ae1 raw.ae2 raw.ae3 raw.ae4"
"raw.lb1 raw.lb2 raw.lb3"
"raw.ex1 raw.ex2"

 

I want a new variable based on the values of variable1 as 

 

newvariable

raw.ae1

raw.ae2

raw.ae3

raw.ae4

raw.lb1

raw.lb2

raw.lb3

raw.ex1

raw.ex2

 

basically "raw.ae1 raw.ae2 raw.ae3 raw.ae4"  is the value of first obseervation of the variable variable1.

 

 

Thank You.

 

 

Solution
‎09-28-2015 02:03 PM
Super User
Posts: 17,829

Re: How to create new observations based on the value of a observation

Similar as this question, except your delimiter is a space. The SCAN() function default delimiter is a space so remove the comma as the delimiter option and it should work for you as well.

https://communities.sas.com/t5/General-SAS-Programming/I-have-multiple-data-in-one-column-separated-...
Occasional Contributor
Posts: 16

Re: How to create new observations based on the value of a observation

Perfect. It worked like a charm.

 

Thank You.

☑ This topic is SOLVED.

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

Discussion stats
  • 4 replies
  • 395 views
  • 1 like
  • 2 in conversation