Start a conversation

How do I export Castor data into SAS?

First export your data with the export type 'CSV'. From here there are two ways to import your Castor data in the CSV files into SAS:

  1. Code
  2. Import data directly from your folder

Code

  1. Move the CSV file in a directory/folder that you can easily find back.
  2. Open a new Program by clicking on the new file icon under "Server Files and Folders, then click "SAS Program (F4)":

  3. Paste the following code in the right panel.
    %web_drop_table(WORK.IMPORT);
    
    FILENAME REFFILE '/folders/myfolders/sasuser.v94/test.csv';
    
    PROC IMPORT DATAFILE=REFFILE
    DBMS=CSV
    OUT=WORK.IMPORT;
    GETNAMES=YES;
    DELIMITER=";";
    RUN;
    
    PROC CONTENTS DATA=WORK.IMPORT; RUN;
    
    %web_open_table(WORK.IMPORT);
  4. Replace the file path '/folders/myfolders/sasuser.v94/test.csv' with your own file path.
  5. Depending on your system, your CSV file is delimited by comma (,) or by semicolon (;). You can check this by opening the file with a text editor application like Notepad or TextEdit, or just try to import first and see how your data import looks like. If your data is delimited by commas, replace the line 'DELIMITER=";";' with 'DELIMITER=",";'
  6. Click on the running man icon or press F3.

Import data directly from your folder

  1. Add the csv file into your 'sasuser' folder (directory). 
    1. If you're not sure where this folder is located, open a new Program by clicking on the new file icon under "Server Files and Folders, then click "SAS Program (F4)":
    2. Paste the following code in the right panel and click on the running man icon or press F3.
      %put My SASUSER folder is %sysfunc(pathname(sasuser));
  2. Click on "Server Files and Folders Pane" in the left panel.
  3. Navigate to the folder where your CSV file is stored.
  4. Right click on your CSV file and click "Import Data".

  5. Depending on your system, your CSV file is delimited by comma (,) or by semicolon (;). You can check this by opening the file with a text editor application like Notepad or TextEdit, or just try to import first and see how your data import looks like.
    1. If your CSV file is delimited by semicolon, click on "Code/Results" in the right panel. The code that is used for importing data is shown in the sub tab "Code".
    2. Click on "Edit" in the sub tab "Code".

    3. Add the following line under PROC IMPORT:
      DELIMITER=";";
    4. Your code will look like the screenshot below. Click on the running man icon or press F3.
    5. Navigate to "OUTPUT DATA" to see your imported data.








Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Castor Support Team

  2. Posted