BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
michtka
Fluorite | Level 6
                 Obs   drug      placebo     total   col0

                1           14.76% 00.00% 12.50%Latin
                2 13   61.90%11   57.89%24   60.00%Caucasian
                7   33.33% 7   36.84%14   35.00%Black
                00.00% 15.26% 12.50%Asian

Hi guys, sorry for the mess of the table have, but i am interested in the last variable (col0) with the value (Latin, Cauc. Black and Asian), and

I am interesting to add a new record heading this table as:

col0='Race' , drug= ' ' , placebo=' ', total=' '

I try the next syntax using INSERT in proc sql (I want to do it in proc qsl) but it doesnt work...any help?

proc sql;

*Add new record;

insert into have

set col0='Race',

Drug=' ',

Placebo=' ',

from have ;

quit;

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Howles
Quartz | Level 8

That only works because all of the affected columns are of character type, and sufficiently wide.

It looks like you are just tweaking headings for display. You should be able to do that with a simple LABEL= spec, as in

  select

   ...

   col0 label='Race'

   ...

   from

   ... ;

michtka wrote:

I got it:

proc sql;

*Add new record;

insert into tablec1

(Drug,Placebo, total, Col0)

values

(' ',' ', ' ', 'Race');

quit;

Thanks.

View solution in original post

3 REPLIES 3
michtka
Fluorite | Level 6

I got it:

proc sql;

*Add new record;

insert into tablec1

(Drug,Placebo, total, Col0)

values

(' ',' ', ' ', 'Race');

quit;

Thanks.

Howles
Quartz | Level 8

That only works because all of the affected columns are of character type, and sufficiently wide.

It looks like you are just tweaking headings for display. You should be able to do that with a simple LABEL= spec, as in

  select

   ...

   col0 label='Race'

   ...

   from

   ... ;

michtka wrote:

I got it:

proc sql;

*Add new record;

insert into tablec1

(Drug,Placebo, total, Col0)

values

(' ',' ', ' ', 'Race');

quit;

Thanks.

michtka
Fluorite | Level 6

Sorry Howles, I saw your answer as correct, but it not, because with col0 label='Race', you change the name of the variable,

when i am not interested in this, I want a new record called 'sex' as another value of the variable col0.

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1556 views
  • 0 likes
  • 2 in conversation