Kaz's SAS, HLM, and Rasch Model
SAS for Text files
Home
Large National Data Sets
Kaz Library
SAS manuals
What is "error"?
Rasch Model
HLM
SAS PROC NLMIXED and GLIMMIX
Factor Analysis
Reading output via SAS
Excel functions for Statistical Analysis
Essays on learning statistics
Statistics in Japanese
My profile
My SAS questions and SAS's responses
My work tool box

Reading and Writing text files

  • Writing a text file
  • Getting rid of trailing spaces after a text (and also getting rid of a line that has no information.)
    data out2;
    set out;
    eachline=trim(eachline);
    LEN=length(eachline);
    run;
    data _null_;set out2;
    counts=lengthn(eachline2);
    if counts ne 0;
    file "&updated";
    put (eachline) ($VARYING250. LEN);
    run;
  • Reading a text file as a data set with one variable (see below)
%let filename=c:\temp\temp.txt;
filename ABC "&filename";
data XXX;
infile ABC length=lg;input @;input @1 eachline $varying200. lg;
run;
Copyright 2005 KU
For information inquiry (AT) estat.us