Help using Base SAS procedures

cant open a permanent data set in sas

Reply
Contributor
Posts: 39

cant open a permanent data set in sas

Hi

I have a big permanent data set in sas and some formats defined on it by my boss. The dataset is in my drive, but I cant open it or view it. SAS replies data file is shorter than expected. I ran the formats before calling the dataset as well. I don't know what I am doing wrong!!

Pls help.

Super User
Posts: 10,460

Re: cant open a permanent data set in sas

Can you show some code on how you have attempted to access this file and any error messages that may appear in the log.

Also define "shorter than expected";

Contributor
Posts: 39

Re: cant open a permanent data set in sas

Hi

I tried viewing the data set by clicking on the sas dataset icon. It gave me message dataset is shorter than expected. use proc datasets option to correct it. later i tried reading data in sas after referencing the libname statement and it showed me 1 observation and 0 variables, which cant be true.

I know that this dataset has a lot of format defined on it. I ran those formats too.

Super Contributor
Posts: 333

Re: cant open a permanent data set in sas

Have you compared the size of the file that was copied to your drive with size of the original? Something may have happened during the copying of the file especially if you are talking about really large file (multiple gbs). I dont think the formats are the problem since not having them would throw a different error than the one you are describing.

I would first verify that the full file was copied correctly to your drive.

EJ

Super User
Posts: 3,100

Re: cant open a permanent data set in sas

Is the dataset backed up at all? It is good practice to ensure that all business-critical SAS data is regularly backed up. If it is being backed up get a restore from a date when you know the dataset was OK.

Super User
Posts: 9,662

Re: cant open a permanent data set in sas

What error message you got ?  Maybe the variable is different .

use the option below and open it .

options validvarname=any ;

Xia Keshan

Super User
Posts: 6,927

Re: cant open a permanent data set in sas

Look at the physical properties of the file (directory listing). This will give you a first idea if the data set contains any data at all.

If it has a sensible size, try to fix it with proc datasets.

If not, look for a backup, or try to recreate it with the code originally used.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 39

Re: cant open a permanent data set in sas

The file is 5kb, although it should be way bigger. I didn't create this dataset, my boss gave me this dataset as a permanent dataset in sas with formats defined on it. She gave me formats as well. I first tried viewing data with viewtable option, but it said dataset is smaller than expected. cant open use proc datasteps to fix it, which I don't know how. I looked up online but not sure how to do it. Can you suggest how can I back up my dataset. I am very naive in sas.

Super Contributor
Posts: 333

Re: cant open a permanent data set in sas

I dont think this is a SAS issue but an corrupt file issue. You may have to go back to the original and get a new copy. Copy the file again and then look in your OS to make sure the copy is the same size as the original. If it matches, then try to read it through SAS.

OR if you have access to the original file location you can try to to point SAS to that file directly and see if you have the same problems.

EJ

Super User
Posts: 17,737

Re: cant open a permanent data set in sas

5kb is an empty data set generally.

Get a new copy of the file as others have suggested.

Also can you show your code where you tried to access it via libname? It's easy to accidentally overwrite a dataset in SAS which is what might have happened.

Super User
Posts: 6,927

Re: cant open a permanent data set in sas

The repair action would look like that:

proc datasets library=my nolist;

repair ncvs0812;

quit;

run;

But that file looks kaput, so as others suggested, get a new copy. And when doing that, have your boss open it on her machine, so you know the file is OK at her site.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 28

Re: cant open a permanent data set in sas

Are both the environment are same,I think this more like an environment issue i.e from windows to Linux  .

If not try this too:

proc datasets library=your lib nolist;

  repair Dataset;

quit;

Contributor
Posts: 39

Re: cant open a permanent data set in sas

libname my "U:\Shared by All\Toussaint_Bahatia\WPV";

OPTIONS nofmterr;
data first;
set my.ncvs0812;
run;

Ask a Question
Discussion stats
  • 12 replies
  • 2634 views
  • 1 like
  • 8 in conversation