BookmarkSubscribeRSS Feed
Mike_Davis
Fluorite | Level 6

Hello!

could anyone help me import this file into SAS?

the extension name is not .txt but it can be read by notepad,I want import this file into SAS without change its extension name(if I change .srt to .txt it will works but i want see whether we don't need to change it).

data one

infile "C:\Users\Lost - [2x07] - The Other 48 Days.XviD-LOL.English.srt;

input contens;

run;

please see attachment.

Thanks!

Mike

4 REPLIES 4
Scott_Mitchell
Quartz | Level 8

You haven't provided any information on the desired output, so I am assuming that you just simply want it read in.

DATA WORK.Lost____2x07____The_Other_48_Day;

    LENGTH

        F1               $ 2000 ;

    FORMAT

        F1               $CHAR40. ;

    INFORMAT

        F1               $CHAR40. ;

    INFILE 'E:\Lost - [2x07] - The Other 48 Days.XviD-LOL.English.SRT'

        LRECL=2000

        TERMSTR=CRLF

        TRUNCOVER ;

    INPUT

        @1     F1               $CHAR2000. ;

RUN;

Peter_C
Rhodochrosite | Level 12

and if Mike just wants to view it in SAS

PROC FSLIST FILE= "that file";

RUN;

jakarman
Barite | Level 11

If you run the following code (corrected missing ") what are the messages?

The infile statement does not care for extensions. With SAS never experienced... SAS(R) 9.4 Statements: Reference

SAS(R) 9.4 Companion for Windows (infile - referencing external files)

By the way, It is really simple short ascii file with 3 record/obs (1/ recno, 2/ timing info 3/ message line(s)   segregated by blank line)

data one

infile "C:\Users\Lost - [2x07] - The Other 48 Days.XviD-LOL.English.srt" ;    /* added the quotes */

input ;  put _infile_ ;

run;

---->-- ja karman --<-----
FriedEgg
SAS Employee

As others have stated, you are missing a closing quotation mark at the end of your infile statement fileref.  The file format is also quite simple.

data subs;

infile '/path/to/file.srt' truncover ;

input #1 id

      #2 xstart_time $12. +5 xend_time $12.

   #3 sub $200.

   #4

;

format start_time end_time time12.3 ;

start_time = input( translate( xstart_time , '.' , ',' ) , time12. ) ;

end_time   = input( translate( xend_time   , '.' , ',' ) , time12. ) ;

drop xstart_time xend_time;

run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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