BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Rixile106
Fluorite | Level 6

good day expects

I have a text file that contains data that looks like below:-
Rixile106_1-1646907379834.png

 

 

But I want to convert the data into Sas dataset, used the below script 

DATA F_FILES.MATURITY_INVEST;
	LENGTH
		'ACCOUNT NO|SERIAL|MATURITY D|OPE'n $ 47;
	LABEL
		'ACCOUNT NO|SERIAL|MATURITY D|OPE'n = "ACCOUNT NO|SERIAL|MATURITY D|OPENED DATE|CLOSED DATE";
	FORMAT
		'ACCOUNT NO|SERIAL|MATURITY D|OPE'n $CHAR47.;
	INFORMAT
		'ACCOUNT NO|SERIAL|MATURITY D|OPE'n $CHAR47.;
	INFILE '/SAS/data/RiskDataManagement/data/NWOW/data/VBM/Data/MATURITY_INVEST.TXT'
		LRECL=47
		ENCODING="LATIN1"
		TERMSTR=CRLF
		DLM='7F'x
		MISSOVER
		DSD;
	INPUT
		'ACCOUNT NO|SERIAL|MATURITY D|OPE'n : $CHAR47.;
RUN;
Spoiler
however am not getting the expected results. i can only see the headings from the output,

 

Rixile106_2-1646907563633.png

 

please assist

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Sajid01
Meteorite | Level 14

Please post the sample data either in the code window or as a text file so that somebody can help.

View solution in original post

2 REPLIES 2
Sajid01
Meteorite | Level 14

Please post the sample data either in the code window or as a text file so that somebody can help.

Kurt_Bremser
Super User

Looks like you need this:

data f_filkes.maturity_invets;
infile
  '/SAS/data/RiskDataManagement/data/NWOW/data/VBM/Data/MATURITY_INVEST.TXT'
  dlm = '|'
  dsd
  truncover
  firstobs=2
;
length
  account_no $9
  serial $3
  maturity_d 4
  opened_date 4
  closed_date 4
;
informat maturity_d opened_date closed_date yymmdd10.;
format maturity_d opened_date closed_date yymmdd10.;
input
  account_no
  serial
  maturity_d
  opened_date
  closed_date
;
run;

Untested; for tested code, supply the text in a code box opened with this button:

Bildschirmfoto 2020-04-07 um 08.32.59.jpg

or attach the file.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 1365 views
  • 0 likes
  • 3 in conversation