+ Reply to Thread
Results 1 to 6 of 6

Thread: new starter struggling with data importing

  1. #1
    Points: 124, Level: 2
    Level completed: 48%, Points required for next Level: 26

    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    new starter struggling with data importing



    Hi all,

    I am new to SAS and very happy to learn the existence of such a forum. Basically, I am having a great deal of problem trying to import data from word/excel, regardless of how simple the dataset is. For example I have saved a file named 'mydata' on the word and saved it on the desktop. Using the coding;

    data mydata;

    infile "C:\Users\Sozenler\Desktop\mydata.txt";

    input gender $ age height weight;

    run;

    it keeps giving the message;

    ERROR: Physical file does not exist, C:\Users\Sozenler\Desktop\SAS 9.1.3 Portable\mydata.txt.
    NOTE: The SAS System stopped processing this step because of errors.
    WARNING: The data set WORK.MYDATA may be incomplete. When this step was stopped there were 0
    observations and 4 variables.
    WARNING: Data set WORK.MYDATA was not replaced because this step was stopped.
    NOTE: DATA statement used (Total process time):
    real time 0.01 seconds
    cpu time 0.01 seconds


    Could you please tell me what could I be doing wrong here?

    Any help would be appreciated.

    Thanks lot in advance

  2. #2
    TS Contributor
    Points: 6,949, Level: 54
    Level completed: 99%, Points required for next Level: 1

    Posts
    783
    Thanks
    0
    Thanked 71 Times in 70 Posts

    Re: new starter struggling with data importing

    Quote Originally Posted by mersin33 View Post
    it keeps giving the message;

    ERROR: Physical file does not exist,
    You have the name of the file, or the directory path (is it .\Desktop or .\Desktop\SAS 9.1.3 Portable ?) wrong.

    I'll throw in one other way to import the file: use the SAS Import Wizard. It's under File / Import Data...

  3. The Following User Says Thank You to Mean Joe For This Useful Post:

    mersin33 (06-09-2012)

  4. #3
    Points: 124, Level: 2
    Level completed: 48%, Points required for next Level: 26

    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: new starter struggling with data importing

    it is the '\Desktop\SAS 9.1.3 Portable' one mate. As for the wizard method, I am fine with it. I just wanted to learn the coding.

    Thanks for the response.

  5. #4
    Points: 145, Level: 2
    Level completed: 90%, Points required for next Level: 5

    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: new starter struggling with data importing

    Not sure which version of SAS you're using, but in Enterprise Guide, you can use the wizard for the import, and then copy the code that SAS automatically generates. Otherwise, I would stick with the wizard import unless you plan on importing the same data set regularly.

  6. #5
    RotParaTon
    Points: 47,169, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Discussion EnderPosting AwardCommunity AwardMaster TaggerFrequent Poster
    Dason's Avatar
    Location
    Ames, IA
    Posts
    9,199
    Thanks
    212
    Thanked 1,642 Times in 1,403 Posts

    Re: new starter struggling with data importing

    There is an import wizard in base sas too. So unless you're running it in batch mode you should be able to use an import wizard which will generate the code to import your file for you.
    "His programming is malfunctioning. It begins! Get your weapons, he's going to become a killbot!!!" - bryangoodrich

  7. #6
    Points: 1,838, Level: 25
    Level completed: 38%, Points required for next Level: 62

    Location
    UK
    Posts
    163
    Thanks
    0
    Thanked 9 Times in 9 Posts

    Re: new starter struggling with data importing


    I generally use import wizard as the others have suggested. I find that sometimes with .xlxs (? new excel files) files it is a bit temperamental, so once you think you have imported it, check that its actually there!

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts








Advertise on Talk Stats