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

Hello,
I'm trying to repair a damaged dataset using the Repair statement but I'm not getting it. 
The dataset was damaged because my computer crashed while i was inserting data to de dataset and now at reading the dataset it says:

 

Seyllia_0-1623851222541.png

 

The thing is this is the exact that Repair Statement is made for (https://www.bing.com/search?q=sas+repair+statement&qs=n&form=QBRE&sp=-1&pq=sas+repair+statme&sc=0-17...).

But I'm not fiding any example code on how to use it and I don't know what I'm doing wrong to repair the dataset.
My code is:

proc datasets;
   repair schema_name.table_name;
run;

Runing this I get this error which I don't know how to avoid it. 

Seyllia_1-1623851434519.png

 

Any help with this?

 

1 ACCEPTED SOLUTION

Accepted Solutions
jimbarbour
Meteorite | Level 14

@Seyllia wrote:

My code is:

proc datasets;
   repair schema_name.table_name;
run;

It's been a while since I've done this, but try this:

proc datasets lib=pa_fraud;
 repair fr006_log_tests;
quit;

Jim

View solution in original post

7 REPLIES 7
LinusH
Tourmaline | Level 20

PROC DATASET differ a little bit from other procedures - you specify the libref on the PROC DATASETS statement.

And then refer to the data set name only (without libref) in the REAPAIR statement.

Data never sleeps
jimbarbour
Meteorite | Level 14

@Seyllia wrote:

My code is:

proc datasets;
   repair schema_name.table_name;
run;

It's been a while since I've done this, but try this:

proc datasets lib=pa_fraud;
 repair fr006_log_tests;
quit;

Jim

Seyllia
Fluorite | Level 6

Thank you! It seems to work like that but the dataset still won't open...

 

Do you have any other idea?

ballardw
Super User

@Seyllia wrote:

Thank you! It seems to work like that but the dataset still won't open...

 

Do you have any other idea?


1) Restart from a backed-up version of the data set.

2) Depending on the type of crash you may have some data in the old work library.

You could run this code:

proc options option=work;
run;

Which will show where your current work library is. It may look something like:

 WORK=C:\Users\Owner\AppData\Local\Temp\SAS Temporary Files\_TD5300_DESKTOP-C36D7SF_
 

 Find the location of the SAS Temporary Files and look for an older folder and see if there are data sets there.

You may want to assign a library to that old location and my recover temporary data from there.

Seyllia
Fluorite | Level 6

Didn't work either.

 

Apart from the actual datasets, i have the .sas7bdat files which I'm not sure what they are. Any way of repairing the dataset from there?

If not, I also found this option DLDMGACTION=FAIL  here SAS File Management: Repairing Damaged SAS Files,  which might work? How would I use it?

Kurt_Bremser
Super User

The .sas7bdat files are SAS datasets.

Can't you restore your dataset from a backup, or recreate it through code?

If both of these options are not there (which means you are just learning an object lesson about the importance of backups, the hard way), try to get SAS Technical Support involved. They may have more advanced means to retrieve hopelessly damaged datasets.

BTW, what is the file size of your .sas7bdat file of the damaged dataset?

Seyllia
Fluorite | Level 6

 The file size 22 Gb and I have the code to recompute it but it will take a long time.

Anyway is the option I'm finally taking, thanks for your help!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 3598 views
  • 5 likes
  • 5 in conversation