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

Hi All,

 

I created a permanent SAS data set and I cannot open the the file.

 

The error reads 'The table "FINAL1.MERGED_DATA" cannot be opened because it does not contain any columns'

 

Any insight into why I cannot open the file would be most helpful and much appreciated.

Below please find my code:

data dataone;
infile '/folders/myfolders/DATA1.TXT' firstobs=7;
input DATE YYMMDD6. DAY BP CD DM;
run;

data datatwo;
infile '/folders/myfolders/DATA2.TXT' firstobs=7;
input DATE YYMMDD6. DAY JY SF;
run;

proc sort data=dataone;
by DATE;

proc sort data=datatwo;
by DATE;
run;

data merged_data;
format DATE YYMMDD6. DAY BP CD DM JY SF;
merge dataone datatwo;
by DATE;
run;

libname final1 '/folders/myfolders/final1';
data final1.merged_data;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
JoshB
Quartz | Level 8

Assuming you don't have any errors before this point, you are missing the part of your last data step that writes out the table you created above.

 

libname final1 '/folders/myfolders/final1';
data final1.merged_data;
  set merged_data;
run;

If you do have other errors, please post.

View solution in original post

6 REPLIES 6
MaikH_Schutze
Quartz | Level 8

Did you get any other errors, for instance for you infile statements?

 

The data step merge probably also has an error. The format statement applies the YYMMDD6. format to your date variable but subsequently listing the other variables in the format statement without supplying a format might also cause an error.

 

Any error along the way will stop a data set from being created.

pawaterman
Fluorite | Level 6

Good points.

However, I did not have any errors .

 

 

JoshB
Quartz | Level 8

Assuming you don't have any errors before this point, you are missing the part of your last data step that writes out the table you created above.

 

libname final1 '/folders/myfolders/final1';
data final1.merged_data;
  set merged_data;
run;

If you do have other errors, please post.

pawaterman
Fluorite | Level 6

Thanks so much JoshB!

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Yes, as JoshB has stated, because you are missing the set statement from the final datastep, SAS creates an empty dataset which has no observations or columns. Hence you get that error of no columns.

pawaterman
Fluorite | Level 6

Much appreciated RW9!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 6 replies
  • 16903 views
  • 4 likes
  • 4 in conversation