BookmarkSubscribeRSS Feed
Ruhi
Obsidian | Level 7

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.

12 REPLIES 12
ballardw
Super User

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";

Ruhi
Obsidian | Level 7

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.

esjackso
Quartz | Level 8

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

SASKiwi
PROC Star

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.

Ksharp
Super User

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

use the option below and open it .

options validvarname=any ;

Xia Keshan

Kurt_Bremser
Super User

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.

Ruhi
Obsidian | Level 7

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.

esjackso
Quartz | Level 8

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

Reeza
Super User

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.

Kurt_Bremser
Super User

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.

LearnByMistk
Obsidian | Level 7

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;

Ruhi
Obsidian | Level 7

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

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 12 replies
  • 7614 views
  • 1 like
  • 8 in conversation