deleteing the obs
Hi I am having 5 crores obs obs with 80 variables i want to delete the obs.I have tryed
delete * from but it was taking more time.
I have tryed
data want;
set want(obs=0);
run;
it works but is there any alternate to delete the obs from the table at once
as truncate table.
Is there any thing like truncate table in sas
Did you want to create a null table without any one obs?
proc sql;
create table want like sashelp.class;
quit;
Ksharp
No Actually is there any thing to delete all the observations in a table .in a tabale i am having 5 crores of data
so i want to delete them at once how can i do .
So, you want to delete all 50 million rows from the dataset, leaving the same dataset containing no rows?
data foo;
input foo;
cards;
0
1
2
3
4
5
;
run;
proc sql;
create table foo like foo;
quit;
data foo;
if _n_=0 then set foo;
stop;
run;
Linlin
Your data step code looks o.k. to me. You could also code it like:
data want;
stop;
set want;
run;
The SQL delete * takes more time because it's actually not truncating the table but only marking rows for deletion - so it has to process all rows AND the table keeps its size.
As Patrick said. It will waste you lots of time.
But there is another statement to delete all obs in a table.
data class; set sashelp.class; label sex='gender'; format weight dollar12.; run; proc sql; delete * from class; quit;
Ksharp
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.