Help using Base SAS procedures

using proc import for CSV file

Reply
Contributor
Posts: 27

using proc import for CSV file

SAS users.

I am having issues of importing the attached CSV file.

I keep getting missing values for the first 2 columns.

What would be the remedy for this? (FYI, My sas version is 9.1)

The code.

%let log_input = file location/OpenSpan_Process_Log_20130213.csv

DATA LOG_INPUT;

/* Enterprise Guide creates this temporary asterisk delimited text file from the original data source */

INFILE "&log_input."

     DELIMITER=','

     MISSOVER

     DSD

     LRECL=32767

     FIRSTOBS=2

;

LENGTH

     eForm_Date 8

     Email_Date $ 18

     OS_Start_Date 8

     OS_Finish_Date 8

                                                                      

     User_Id $ 10

     Status $ 9

     Unique_ID $ 24

     App_Type $ 8

     Application_No 8

     _T_Application_No $ 12

     Outcome $ 10

     _W_StringValue $ 22

;

INFORMAT

     eForm_Date DATETIME18.

     OS_Start_Date DATETIME18.

     OS_Finish_Date DATETIME18.

;

FORMAT

     eForm_Date DATETIME18.

     OS_Start_Date DATETIME18.

     OS_Finish_Date DATETIME18.

;

INPUT

     eForm_Date : ANYDTDTM22.

     Email_Date $

     OS_Start_Date : ANYDTDTM22.

     OS_Finish_Date : ANYDTDTM22.

     User_Id $

     Status $

     Unique_ID $

     App_Type $

     _T_Application_No $

     Outcome $

;

DROP

     _T_Application_No

     _W_StringValue

     _W_NumericValue

;

LABEL

     eForm_Date = "eForm_Date"

     Email_Date = "Email_Date"

     OS_Start_Date = "OS_Start_Date"

     OS_Finish_Date = "OS_Finish_Date"

     User_Id = "User_Id"

     Status = "Status"

     Unique_ID = "Unique_ID"

     App_Type = "App_Type"

     Application_No = "Application_No"

    Outcome = "Outcome"

;

_W_StringValue = _T_Application_No;

LINK CheckForLogicValue;

Application_No = _W_NumericValue;

RETURN;

/* Requires _W_StringValue to be set with the value to be checked */                                   

CheckForLogicValue:

IF UPCASE(TRIM(_W_StringValue)) = "TRUE" THEN

    _W_NumericValue = 1;

ELSE

    IF UPCASE(TRIM(_W_StringValue)) = "FALSE" THEN

        _W_NumericValue = 0;

   ELSE

        _W_NumericValue = INPUT(_W_StringValue, COMMA32.);

RETURN;

RUN;

Attachment
Super User
Posts: 10,500

Re: using proc import for CSV file

When I looked up the details on the ANYDTDTMw. format it doesn't look like it supports the format your data for eForm_date appears in the file. You may need to read and parse the time and date parts of that field separately and combine to get a datetime value.

Ask a Question
Discussion stats
  • 1 reply
  • 215 views
  • 0 likes
  • 2 in conversation