View previous topic :: View next topic |
Author |
Message |
js01 Beginner
Joined: 13 Oct 2005 Posts: 84 Topics: 32 Location: INDIA
|
Posted: Mon Mar 15, 2010 1:15 pm Post subject: How to concatenate two input files in SAS |
|
|
Hi friends,
I am trying to create a SAS dataset using two input files , below are the input files
RECF=VB
LRECL=250
infile1:
Code: |
filed1(7)filed2(2) filed3(5) filed4(15) filed5(7)
AAAA BBCCCCCKKKKKKKKKKKKKKKYYYYYYY
A1BA11 012345UUUUUUUUUUUUUUUZZZZZZZ
2122 37777 TTTTTTTTTTTTTTTIIIIII
|
infile2 Code: |
filed1(7)filed2(2) filed3(5) filed4(15) filed5(7)filed6(x) filed7(y)......
AAAA BCCCCCKKKKKKKKKKKKKKK123455qqqqqqqquuququququququuq
2122 37777 TTTTTTTTTTTTTTTLLLLLLFFFFFFFFFFFFFDDDDDEEEEE
|
output should be Code: |
AAAA BBCCCCCKKKKKKKKKKKKKKK123455YYYYYYYqqqqqqqquuq.
2122 37777 TTTTTTTTTTTTTTTLLLLLLIIIIIIFFFFFFFFFFFFFDDDDDEEEEE
|
infile1 and infile2 has same key ,
first file2 reads and do format (some business logic) and then the next field should be populated from infile1 where infile1key = infile2key
Please help me |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
js01 Beginner
Joined: 13 Oct 2005 Posts: 84 Topics: 32 Location: INDIA
|
Posted: Mon Mar 15, 2010 4:17 pm Post subject: |
|
|
Thank you very much Kolusu
I am new to the SAS ,could you please is there any user defind function in SAS ,
actually i want assign a value that retuirns from function.
Regards |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Mon Mar 15, 2010 5:10 pm Post subject: |
|
|
js01 wrote: | Thank you very much Kolusu
I am new to the SAS ,could you please is there any user defind function in SAS , actually i want assign a value that retuirns from function.
Regards |
Js01,
What do you think the above examples show? If you want a new function " match_any_file_I_can_think_of" then may be you need to start writing one.
Kolusu |
|
Back to top |
|
 |
js01 Beginner
Joined: 13 Oct 2005 Posts: 84 Topics: 32 Location: INDIA
|
Posted: Tue Mar 16, 2010 11:27 am Post subject: |
|
|
Hi Kolusu,
actually i got a requirement to add a new field to existing SAS dataset , this SAS dataset is loaded with inpufile (VB , 250 length) with business logic. input file has the packed decimal values along with chars and numbers,
i have added new field to inputfile after 250 (which will pass from previous step)
like below
DATA SAS1
INFILE infile1
INPUT @0001 key 16
@120 var2 PD
@ .......
@251 newfield $10
some busines logic
-----
the newfiled is getting populated with zigzag data , when i used fixed block file then it was having correct value (this tested with business logic)
so i am thinking to pass new value with different file ( new) to SAS,hence want to use a function which will retrun a value
like below
DATA SAS1
INFILE infile1
INPUT @0001 key 16
@120 var2 PD
@ .......
@251 newfield $10
some busines logic
-----
newfield = getvalue(key)
---------
end
function getvalue (key)
proc sort data=sas2 output=sas3
infile inputfile2
input @001 Key 16
@015 var5 $10
return var5
end
is this possible in sas, please help me |
|
Back to top |
|
 |
|
|