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.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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