DATA Step, Macro, Functions and more

Error activity

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 14
Accepted Solution

Error activity

Hello!!

I need your help.

I.m doing a activity .This is my activity.

 

In this practice, you submit a SAS program, review the log messages, and examine the results.

Reminder: Make sure you've defined the orion library.

  1. Copy and paste the following code into the editor.

    data work.newcountry;
       length Country_Code $ 2 Country_Name $ 48;
       infile "&path/country.dat" dlm='!'; 
       input Country_Code $ Country_Name $;
    run;
    
    proc print data=work.newcountry;
    run;
  2. Submit the code and then examine the results. How many rows and columns are in the report?


  3. Examine the log. Based on the log notes following the DATA step, how many observations and variables are in the data set work.newcountry?

 

Ok, I create my library, this library is called Bea but can I can run my codige I have this message.

 

ERROR: Physical file does not exist, /folders/myfolders/ecprg193/country.dat.

 

I don,t understant this because this is the first activity and before I didn.t explain me anything.

 

Thanks!!!!!!!!!

 

Bea


Accepted Solutions
Solution
‎10-21-2016 01:55 PM
SAS Super FREQ
Posts: 8,743

Re: Error activity

Hi: There is NOT a zip file. As Reeza suggests, you must look at my picture of the tasks in #2 above and follow ALL the instructions in Task 1. It looks like you made a folder. That is good. That means your 2 statements for Task 1, #4 are:
%let path=/folders/myfolders/ecprg193;
libname orion "&path";

But that is NOT enough. You MUST finish ALL the steps in Task 2. Task 2, #2 has a link to click which brings the code into a popup window. You MUST copy and paste that code from Task 2, #2 into your Editor Window and run the code, as I show in my #3 screen shot, after you run the code successfully (from Task 2) then you should see the files under the ecprg193 folder.

cynthia

View solution in original post


All Replies
Super User
Posts: 17,840

Re: Error activity

Where is this 'activity' from?

Frequent Contributor
Posts: 123

Re: Error activity

[ Edited ]

In the beginning instructions when setting up the course, you should have downloaded a zip file that contains the files you need to run the practice programs, like the country.dat data file you're referencing in this program. First, did you download the these? Second of all, you have to make sure you placed those files in the location that you've specified as the path: /folders/myfolders/ecprg193/. You may just have the files in a different location.

SAS Super FREQ
Posts: 8,743

Re: Error activity

[ Edited ]

Hi:
In the Programming 1 e-learning class, we do NOT provide the SAS datasets in a zip file. (only EG and JMP and EM classes have zip files with data sets -- programming courses have programs to make the data and a few courses have some Excel files in a zip archive).

The Programming 1 e-learning class has a program inside the e-learning course that the student must copy and paste into their editor and that program, when run, makes ALL the data sets and .DAT files that are used in the course.

The OP did not indicate what class they were following, but the Reminder text looks like it comes straight out of the e-learning course.

In the e-learning course, in the instructions, the student is told to create a file called setup.sas or make a snippet file in SAS Studio that contains these 2 statements:
%let path=/folders/myfolders/ecprg193;
libname orion "&path";

That way if &PATH exists then the INFILE statement (as shown in the OP code)
infile "&path/country.dat" dlm='!';

Will work, because &PATH will have a value or path, as assigned in the setup.sas or setup snippet.

However, if you do NOT ever run the instructions in the Course Overview section of Programming 1, then the physical location will be empty.

BTW, in the Programming 1 class, all of our programs are expecting a library called ORION (not a library called BEA). And, all of our programs are expecting that the student will follow the instructions and issue a %let statement to create the "helper" macro variable called &PATH.

The "physical file does not exist message" implies to me that the OP did not follow ALL of the instructions in the Course Overview and Data Setup section of the Programming 1 e-learning course.

Reading country.dat is NOT the first activity. Running the program and doing the setup in the Course Overview section is the first activity and if you don't follow and complete ALL of the instructions, then the data files will not exist when you move into the lessons.

cynthia

 

 I can exactly replicate your error message if I submit my code WITHOUT submitting the setup program, as instructed in Task 1 in the course instructions.

1) Can generate the SAME error message if &PATH is not defined

duplicate_error_message_if_no_path.png

 

2) Instructions that show where to save the setup statements

pg1_instructions_ue.png

 

3) program submitted successfully AFTER running necessary statements

successful_read_country_dat_file.png

Occasional Contributor
Posts: 14

Re: Error activity

Hi! 

This is my problem

archivo2.png

 

archivo1.png

I have this error and I don.t know as resolve

 

Thanks!!!!!

 

Bea

 

 


archivo1.png
Occasional Contributor
Posts: 14

Re: Error activity

Hi.Where is this zip file? I can.t see it

 

Thanks

Super User
Posts: 17,840

Re: Error activity

See @Cynthia_sas post, #2 and look at the second red box highlighted. 

Occasional Contributor
Posts: 14

Re: Error activity

I wrote this code in my program.

 

%let path=/folders/myfolders/ecprg193;
libname orion "&path";

 

 

 

The log was 

NOTE: El libref ORION se ha asignado correctamente:
Motor: V9
Nombre físico: /folders/myfolders/ecprg193ç
 
later 
data work.newcountry;
length Country_Code $ 2 Country_Name $ 48;
infile "&path/country.dat" dlm='!';
input Country_Code $ Country_Name $;
 
The log is 
data work.newcountry;
61 length Country_Code $ 2 Country_Name $ 48;
62 infile "&path/country.dat" dlm='!';
63 input Country_Code $ Country_Name $;
64
65 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
ERROR: Physical file does not exist, /folders/myfolders/ecprg193/country.dat.
 
 
 
Super User
Posts: 17,840

Re: Error activity

Did you copy the code from the CLICK HERE link and run it?

Solution
‎10-21-2016 01:55 PM
SAS Super FREQ
Posts: 8,743

Re: Error activity

Hi: There is NOT a zip file. As Reeza suggests, you must look at my picture of the tasks in #2 above and follow ALL the instructions in Task 1. It looks like you made a folder. That is good. That means your 2 statements for Task 1, #4 are:
%let path=/folders/myfolders/ecprg193;
libname orion "&path";

But that is NOT enough. You MUST finish ALL the steps in Task 2. Task 2, #2 has a link to click which brings the code into a popup window. You MUST copy and paste that code from Task 2, #2 into your Editor Window and run the code, as I show in my #3 screen shot, after you run the code successfully (from Task 2) then you should see the files under the ecprg193 folder.

cynthia
Occasional Contributor
Posts: 14

Re: Error activity

@Cynthia_sas @Reeza ohhh I can now!!!!! Thanks for your patient with me!!!! Smiley Happy

Super User
Posts: 17,840

Re: Error activity

If you're on SAS UE and using the free e training courses, see this post:

https://communities.sas.com/t5/Base-SAS-Programming/Orion-Library-on-SAS-university-edition/m-p/3028...

 

Occasional Contributor
Posts: 14

Re: Error activity

Thanks but I did  these steps and I have the same error  Smiley Frustrated

 

archivo2.png

SAS Super FREQ
Posts: 8,743

Re: Error activity

Did you actually RUN the program in Task 2, step 2, as highlighted in my previous posting. If so, and if the program WAS successful, then you would have files underneath the ecprg193 folder.

Since you do NOT have files under the ECPRG193 folder, you will need to go back to the beginning and do not try to read country.dat until AFTER you have run the program from Task 2, step 2 successfully and you see files under the ecprg193 folder.

cynthia
SAS Super FREQ
Posts: 8,743

Re: Error activity

Hi:

  Here is a set of numbered screen shots that illustrate the entire process from an empty folder for ecprg193 to a successful program.

Start with instructions

_0_start_with_instructions_inside_course.png

 

#1 Make a folder (you have already done this step)

_1_make_folder_for_class.png

 

#2 Check folder properties

_2_right_click_see_folder_properties_note_correct_path.png

 

#3 Run "setup" with LIBNAME

_3_after_setup_task_1_LIBNAME.png

 

#4 at some point save code as setup.sas or save as snippet

_4_save_as_setup_file.png

 

#5 Task 2, Step 2, Paste code into the Studio editor window

_5_code_pasted_in_editor_window.png

 

#6 After code runs, see files in ecprg193 folder and see PROC CONTENTS in Results window

_6_after_Task2_code_runs_in_SAS_Univ_Edition.png

 

#7 After Task 2, Step 2 code runs successfully, you should be able to see the files in your shared folder location

_7_compare_windows_view_of_shared_folder_with_UE_view.png

 

Note that your shared folder location might not be the same as what is shown in my screen shot.

 

You CANNOT try to read COUNTRY.DAT until AFTER you have successfully run the program inside Task 2.

 

cynthia

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 14 replies
  • 544 views
  • 1 like
  • 4 in conversation