BookmarkSubscribeRSS Feed
sas_
Fluorite | Level 6
Hi
i am having variables in Text file with pipe delimited and the data for this is in another excel sheet how can i create a dataset out of this. In Base SAS,.
5 REPLIES 5
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Investigate using PROC IMPORT.

Scott Barry
SBBWorks, Inc.

Recommended Google advanced search, this topic/post:

proc import pipe delimited site:sas.com
Patrick
Opal | Level 21
If you're using SAS EG:
The import wizard (File/Import) makes reading data into SAS quite an easy task.
sas_
Fluorite | Level 6
But i want in base sas
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You will need to use a DATA step approach. Refer to the SAS support http://support.sas.com/ website and the recommended Google advanced search argument for related technical and conference papers on the topic. Or use the website's SEARCH facility.

Scott Barry
SBBWorks, Inc.
sas_
Fluorite | Level 6
i got the solution

/*First Read the variables in Excel sheet*/
PROC IMPORT OUT= WORK.var
DATAFILE= "C:\Documents and Settings\Desktop\var.xlsx"
DBMS=EXCEL REPLACE;
RANGE="sam$";
GETNAMES=YES;
MIXED=NO;
SCANTEXT=YES;
USEDATE=YES;
SCANTIME=YES;
RUN;

/*caputring all the variables in to macro varaiable*/
proc sql noprint;
select name into :name separated by " "
from dictionary.columns where libname="WORK" and memname="VAR";
quit;
/*datafile with obs*/
filename text "C:\Documents and Settings\Desktop\values.txt";
/*outputfile*/
filename output "C:\Documents and Settings\Desktop\Output.txt";

data _null_;
infile text;
file output;
if _N_ eq 1 then put "&name"; * put header row;
input; * read one row;
put _infile_; * write read buffer to second file;
run;

proc import out=final datafile="C:\Documents and Settings\Desktop\Output.txt" replace;
delimiter=" ";
getnames=yes;
run;

then import the output.txt in to new Dataset
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1625 views
  • 0 likes
  • 3 in conversation