DATA Step, Macro, Functions and more

Add observations to a variable

Reply
Frequent Contributor
Posts: 78

Add observations to a variable

Hi,

I need some help in adding rows (observations) of one column to the other column from the same table. I have a table with two variables (see below).

 

Type of call           Categories

MVA                      Cardiac

Trauma                 Cardiac

No                         Respiratory

MVA                      Cardiac

NO                        Neuro

MVA                      Neuro

Trauma                 Cardiac

 

I want to add type of call to Categories so the output should look like

Type of Call           Categories

No                         Cardiac

                             Cardiac

No                         Respiratory

                             Cardiac

NO                        Neuro

                             Neuro

                            Cardiac

                            MVA

                            MVA

                            MVA

                            Trauma

                            Trauma

 

Can anybody please help me getting this output?

 

Thank you

M

Trusted Advisor
Posts: 1,400

Re: Add observations to a variable

Posted in reply to Malathi13

What are the rules you wish to use to get from table1 to table2?  Please explain clearly.

Frequent Contributor
Posts: 78

Re: Add observations to a variable

Hi,

I'm using only one table, the two columns are from the same table and I'm trying to add observations from column1 to column2.

 

 

 

M

Trusted Advisor
Posts: 1,400

Re: Add observations to a variable

Posted in reply to Malathi13

OK, so you're trying append column 1 values to column 2, but you have not explained:

 

  1. Which values to append, since you have apparently excluded some.
  2. What order you want those appended values to have
  3. By what rule did you get an output row of "NO" and "CARDIAC"

 

We cant' read you mind, which is why we need clear and complete description of the task.

 

Also, you can help yourself if you put the starting data in the form of a sas data step, with a data set name, ,an input statement, datalines statement, and the data.

 

Ask a Question
Discussion stats
  • 3 replies
  • 50 views
  • 0 likes
  • 2 in conversation