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

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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