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

Hello all-

I am quite new to SAS (I actually learned the basics some years ago but have since not needed to use the software) and am having trouble running a program that was provided by another researcher to input and clean their dataset (both the programs and data are publicly available). I have tried to adapt the initial commands to direct to where I have put the datasets, but when I run the program I end up with a dataset which has all the variable names but is empty!! Below is the initial part of the code. My procees has been:

1) download the file dist91.data.gz from the source

2) place this file in C:\temp\ directory

3) Change the "libname "statement below to read : libname sasdata 'C:\temp';

4) hit "run"

5) end up with an empty dataset.

6) I have also tried the same as above and also unzipping the .gz file into its raw .dat format, and changing the filename statement to read: filename indata91  'dist91.dat';

7) same thing happens.

As far as I know, this code was written in 2003 and possibly not changed or debugged for newer releases of SAS? I am currently running SAS 9.1 on a Windows 7 based PC. I am probably missing some important syntax, or the code was written for UNIX?

The data and programs are downloadable here: http://www.bsos.umd.edu/socy/vanneman/districts/files/index.html

I am in need to processing the 1991 data to support an academic research grant application, and can't even get this first piece done. Any thoughts or help most appreciated!

_______________________________________Begin SAS code:

/* Users will need to create their own libname and filename commands

   as appropriate for their local computer system

*/

libname  sasdata '.';

filename indata91  pipe 'gunzip -c dist91.data.gz';

data sasdata.dist91 (label='Indian 1991 districts: from dist91.dat');

    /* These temporary variables are used only to check

       correct order of input data file */

    drop rec140 rec160 rec300 rec340 rec620 rec650 rec670 rec690 ;

    attrib DLABEL length = $ 28;

infile indata91 ;

input

/*000*/  /* label record */ 

   stateid  $ 1-2

   distid   $ 3-4

   rec000     5-7 

   year       8-9 

   version     10 

   dlabel &

  /* Total Population */ 

/ /*100*/  pop  11-19  rural 20-28  male  29-37  Rmale  38-46

1 ACCEPTED SOLUTION

Accepted Solutions
DF
Fluorite | Level 6 DF
Fluorite | Level 6

The default looks like it's set up for a unix based system, or at least where "gunzip" is available (which you can get for Windows too).

I managed to get it to run by following your instructions, but changing the libname and filename statements as below (with the data file unzipped manually).

libname  sasdata 'C:\temp\';

filename indata91 'C:\temp\dist91.dat';

Hope that helps!

View solution in original post

1 REPLY 1
DF
Fluorite | Level 6 DF
Fluorite | Level 6

The default looks like it's set up for a unix based system, or at least where "gunzip" is available (which you can get for Windows too).

I managed to get it to run by following your instructions, but changing the libname and filename statements as below (with the data file unzipped manually).

libname  sasdata 'C:\temp\';

filename indata91 'C:\temp\dist91.dat';

Hope that helps!

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
  • 1 reply
  • 1208 views
  • 0 likes
  • 2 in conversation