BookmarkSubscribeRSS Feed
R_Win
Calcite | Level 5
Hi i am having a excel file i want to import it into sas and I should declare length,format and informat during the importing only. I have tryed by using FILENAME and INFILE but it is not coming can any one help me the code for this. And with out DDE,Before a dataset being creating i.e during the import process i need to apply formats.
2 REPLIES 2
Oleg_L
Obsidian | Level 7
Hi
If you have to use DDE-engine then look at the example of the code below:
[pre]
filename dt dde 'excel|dt!r2c1:r65536c23' ;
data dt2 ;
infile dt missover notab dlm='09'x dsd ls=20000;
informat site $3. sbal_kod $5. ss_kod $15. simbol $5. ss_naim $100. ss_ostd comma20. ss_ostc comma20.
client $100. k_client $12. client_t $1. paccsbal $8. acc4 $8. comiss $1.
comm_adj $200. drcr $2. sbalname $200. acc3 $8. acc2 $8. acc1 $8. accnr4 $200. accnr3 $200. accnr2 $200. accnr1 $200.;
input site sbal_kod ss_kod simbol ss_naim ss_ostd ss_ostc client k_client client_t paccsbal acc4 comiss comm_adj
drcr sbalname acc3 acc2 acc1 accnr4 accnr3 accnr2 accnr1;
run;
[/pre]


Oleg.
Oleg_L
Obsidian | Level 7
If you don't want DDE then use libname Excel engine:
[pre]
libname xl excel 'd:\mbm\2010\acc.xls';
data comiss;
length comm_adj $200. ss_naim $100. client $100.;
informat comm_adj $200. ss_naim $100. client $100.;
set xl.newacc;
format comm_adj $200. ss_naim $100. client $100.;
run;
libname xl clear;
[/pre]

Oleg.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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