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.
Just make sure you don't have Cc table already created with one empty observation.
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
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.