Have the users do their work in SAS with SAS datasets, and when the desired dataset is prepared, run PROC DELETE to remove the database table and create it anew.
Have the users do their work in SAS with SAS datasets, and when the desired dataset is prepared, run PROC DELETE to remove the database table and create it anew.
What you describe is generally considered poor practice in the world of relational databases. It is also possible that your current data design is poor if this sort of thing, adding variables to the same-named table, is needed.
A more typical approach would be to have a view or query that reads the existing data table that had the results needed and use the view for reporting or whatever that table with the additions is used for. Properly designed views would use "new" table after import or update or what ever is causing new data. Then nothing to delete, just remember to use the view instead of the raw data table.
Hello @mokwenak
" However, this behavior doesn’t seem possible in Microsoft SQL....".
This behavior is possible in MS SQL Server but not in the same way as SAS. Here are some hints.
1.Once can always alter table and add /remove columns
2.MS SQL server has the option to create session scope temporary table. At the end of the session the data is lost. Something like SAS work in functionality . They can be used as an intermediate storage.
3.There is another feature called common table expressions which are named result set that can be withing the same query.
Ultimately it depends on your exact needs and the ability to make use of the available features.
Tables in databases need stable structures. Unlike with SAS Files (tables) you normally also create the table structure only once and then insert, update or delete data attached to this structure.
What you are describing feels like a bad use case for using SQL Server tables as "dumping ground" for SAS output. It only complicates things for your users and likely also increases end-to-end processing time caused by frequent data transfers between SAS and the database.
What is the reason for pushing "all" SAS output to SQL Server?
The SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment.
SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.
Find more tutorials on the SAS Users YouTube channel.