BookmarkSubscribeRSS Feed
chouchou
Calcite | Level 5

proc Hi guys,

I worte the following code to create a data set named CC and then insert 6 observations into the new data set CC.

However, the data set comes with first row value of each variable are null, it is from the second row to the seventh row that contains the obs that I just inserted.

How come I receive this result?

proc sql;
create table CC
(ID char(3),
  Name char(6),
  JobCode char(3),
  Salary num);
quit;

proc sql;
insert into Cc
values ('001','Albert','PT1',50000)
values ('002','Brenda','PT1',70000)
values ('003','Carl','PT1',60000)
values ('004','Donna','PT2',80000)
values ('005','Edward','PT2',90000)
values ('006','Flora','PT3',100000);
quit;

Result:

     ID     Name          Jobcode          Salary

1

2  001  Albert          PT1               50000

3  001 Brenda          PT1               70000

.......

By the way, if I input variable values directly in Viewtable just like we input data in Excel, then how to insert the variable names into the data set? If I've already change the default variable attribute and lead to that I cannot put variable name above numeric and length specified column?

Thank you.

2 REPLIES 2
stat_sas
Ammonite | Level 13

Just make sure you don't have Cc table already created with one empty observation.

PGStats
Opal | Level 21

It must be something you did between the two SQL steps. Running the code you provided simply doesn't give an empty first observation. - PG

PG

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 1176 views
  • 0 likes
  • 3 in conversation