I'm not exactly sure what is happening, but I need to replace one data set with another in a library. The current data set has 710 columns, the new data set has 715 columns. Every time I replace the current with the new, whether it is through code or direct Windows copy, the added columns disappear. The columns are the last 5 in the data set. Why is this happening and what can I do to fix it?
Hi @arjessup
You need to give us some more details about your SAS products and process. Are the added columns missing when you browse the data set, or when you run a proc contents?
If you are using a SAS product that works with SAS metadata, like DI Studio, SAS only sees the columns defined in metadata. You get an error if a column does not exist in the physical table, and a column in the physical table is ignored, if it is not present in the table metadata..
This is a common problem in DI Studio when working with user defined transformations or user-written code, where the physical output table is created by the code independent of metadata. I often forget to update table metadata after the transformation is run.
Show us your SAS log from running the code that is trying to "replace" the dataset.
have you tried to delete the data set then run your code to create the new data table with the extra columns?
Hi @arjessup
You need to give us some more details about your SAS products and process. Are the added columns missing when you browse the data set, or when you run a proc contents?
If you are using a SAS product that works with SAS metadata, like DI Studio, SAS only sees the columns defined in metadata. You get an error if a column does not exist in the physical table, and a column in the physical table is ignored, if it is not present in the table metadata..
This is a common problem in DI Studio when working with user defined transformations or user-written code, where the physical output table is created by the code independent of metadata. I often forget to update table metadata after the transformation is run.
They are not in the view. When I run PROC CONTENTS, they are in the data set.
Hi @arjessup
Which means that your code is working, because the data set is replaced.
You say "they are not in the view". Do you mean you access the data set through a separately stored view with the filetype sas7bvew? - if so, you must manually update the view to include the new variables.
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.