BookmarkSubscribeRSS Feed
GAUTAMDVN
Calcite | Level 5

In the raw Crime stats data file, change the delimiter from comma to space and then import the file into SAS (be careful about embedded space in the city name!)

12 REPLIES 12
Reeza
Super User

What’s your question? That reads like a homework or test question - so show your work so far. 

 


@GAUTAMDVN wrote:

In the raw Crime stats data file, change the delimiter from comma to space and then import the file into SAS (be careful about embedded space in the city name!)


 

GAUTAMDVN
Calcite | Level 5

Below is the code  of mine:

 

DATA _NULL_ ;
INFILE CRIME DSD;
INPUT	City : $18.
		Population
		Crime_index 
		Total_crime_index  
		MANM 
		Forcible_rape
		Robbery
		Aggravated_assault
		Burglary
		Larceny_theft
		Motor_vehicle_theft
		Arson ;
FILE  'LEARN.CRIME_STATS.TXT' ;
RUN ;

 and below is the error I'm getting

 

ERROR: Insufficient authorization to access /opt/sasinside/SASConfig/Lev1/SASApp/LEARN.CRIME_STATS.TXT.
Reeza
Super User

Your infile statement is incorrect. 

 

It should be of the form:

 

infile 'path to file including extension' dlm=' ' truncover;

Your file reference comes after so try and move it up and see if that works.

 


@GAUTAMDVN wrote:

Below is the code  of mine:

 

DATA _NULL_ ;
INFILE CRIME DSD;
INPUT	City : $18.
		Population
		Crime_index 
		Total_crime_index  
		MANM 
		Forcible_rape
		Robbery
		Aggravated_assault
		Burglary
		Larceny_theft
		Motor_vehicle_theft
		Arson ;
FILE  'LEARN.CRIME_STATS.TXT' ;
RUN ;

 and below is the error I'm getting

 

ERROR: Insufficient authorization to access /opt/sasinside/SASConfig/Lev1/SASApp/LEARN.CRIME_STATS.TXT.

 

GAUTAMDVN
Calcite | Level 5

Hi, thanks for helping but no luck SAS log window showing the same error.

 

ERROR: Insufficient authorization to access /opt/sasinside/SASConfig/Lev1/SASApp/LEARN.CRIME_STATS.TXT.
Reeza
Super User

Post your code and log again then.

 


@GAUTAMDVN wrote:

Hi, thanks for helping but no luck SAS log window showing the same error.

 

ERROR: Insufficient authorization to access /opt/sasinside/SASConfig/Lev1/SASApp/LEARN.CRIME_STATS.TXT.

 

Reeza
Super User
Or compare your code to the one used in your other question. That one seems to reference the file correctly to read it in, use the same approach here.
Kurt_Bremser
Super User

@GAUTAMDVN wrote:

Hi, thanks for helping but no luck SAS log window showing the same error.

 

ERROR: Insufficient authorization to access /opt/sasinside/SASConfig/Lev1/SASApp/LEARN.CRIME_STATS.TXT.

When you do not specify an absolute path, SAS will look for the file in the current working directory. You have to specify a fully qualified path name starting at root.

error_prone
Barite | Level 11

@GAUTAMDVN wrote:

Hi, thanks for helping but no luck SAS log window showing the same error.

 

ERROR: Insufficient authorization to access /opt/sasinside/SASConfig/Lev1/SASApp/LEARN.CRIME_STATS.TXT.

Then the path you provided is still not correct. Without seeing the code you submitted, i can just guess what went wrong.

Tom
Super User Tom
Super User

Why do you have FILE statement without any PUT statements?

Kurt_Bremser
Super User

@GAUTAMDVN wrote:

Below is the code  of mine:

 

DATA _NULL_ ;
INFILE CRIME DSD;
INPUT	City : $18.
		Population
		Crime_index 
		Total_crime_index  
		MANM 
		Forcible_rape
		Robbery
		Aggravated_assault
		Burglary
		Larceny_theft
		Motor_vehicle_theft
		Arson ;
FILE  'LEARN.CRIME_STATS.TXT' ;
RUN ;

 and below is the error I'm getting

 

ERROR: Insufficient authorization to access /opt/sasinside/SASConfig/Lev1/SASApp/LEARN.CRIME_STATS.TXT.

This whole step serves no purpose. It reads some data from an external file, but does not out that anywhere.

Since you have no put statement to write data to the external file named in the file statement, that statement is useless.

If you want to read data from an external file into a dataset, you have to name that dataset in the data statement.

So you should test this:

data want;
infile crime dsd;
input
  City : $18.
  Population
  Crime_index 
  Total_crime_index  
  MANM 
  Forcible_rape
  Robbery
  Aggravated_assault
  Burglary
  Larceny_theft
  Motor_vehicle_theft
  Arson
;
run;

and post the log from that.

 

Tom
Super User Tom
Super User

@GAUTAMDVN wrote:

In the raw Crime stats data file, change the delimiter from comma to space and then import the file into SAS (be careful about embedded space in the city name!)


Sounds like they want a two step process.

 

1) change the delimiter from comma to space

2) import the file into SAS 

 

I assume the mean to use the output of the first task as the input to the second.

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!

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
  • 12 replies
  • 1078 views
  • 0 likes
  • 5 in conversation