How come the first row values are null when input data to create a new data set?

Reply
Contributor
Posts: 68

How come the first row values are null when input data to create a new data set?

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.

Trusted Advisor
Posts: 1,204

Re: How come the first row values are null when input data to create a new data set?

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

Respected Advisor
Posts: 4,641

Re: How come the first row values are null when input data to create a new data set?

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
Ask a Question
Discussion stats
  • 2 replies
  • 166 views
  • 0 likes
  • 3 in conversation