SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Demographer
Pyrite | Level 9

Hi,

I have to call those lines (among others) with %include:

expo1=exp(C_ANGLO_0_5*PANGLO_0_5+C_ANGLO_5_10*PANGLO_5_10+C_ANGLO_25_60*PANGLO_25_60+C_ANGLO_60*PANGLO_60+1*(C_ANGLOxFRANCO_0_5*PANGLO_0_5+C_ANGLOxFRANCO_5_10*PANGLO_5_10+C_ANGLOxFRANCO_25_60*PANGLO_25_60+C_ANGLOxFRANCO_60*PANGLO_60)+

C_ALLO_0_1*PALLO_0_1+C_ALLO_1_3*PALLO_1_3+C_ALLO_10*PALLO_10+1*C_ALLOxFRANCO_0_1*PALLO_0_1+C_ALLOxFRANCO_1_3*PALLO_1_3+

C_ALLOxFRANCO_10*PALLO_10+C_POT_0_500*POT_0_500+C_POT_500_2000*POT_500_2000+C_POT_5000_20000*POT_5000_20000+C_POT_20000*POT_20000+

C_POP_0_5000*POP_0_5000+C_POP_5_10000*POP_5_10000+C_POP_25_75000*POP_25_75000+C_POP_75000*POP_75000+C_AUTOROUTE*AUTOROUTE+

C_DISTANCE*DISTANCE+C_RIVE_NORD*RIVE_NORD+C_RIVE_SUD*RIVE_SUD+C_LONGUEUIL*LONGUEUIL+C_LAVAL*LAVAL+C_MONTREAL*MONTREAL);


Because I use an %include statement, I get the "truncated record" WARNING. I read that this happens when there is more than 250 characters et that the solution is to reduce the amount of characters. I guess I could divide this equation in 3 or 4 different, but I wonder if there is any other solution.


Thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Just put in some end of lines.  Any where you want that doesn't split a variable name or keyword.  How about in front of every + sign?

expo1=exp(C_ANGLO_0_5*PANGLO_0_5

+C_ANGLO_5_10*PANGLO_5_10

+C_ANGLO_25_60*PANGLO_25_60

+C_ANGLO_60*PANGLO_60

+1*(C_ANGLOxFRANCO_0_5*PANGLO_0_5

+C_ANGLOxFRANCO_5_10*PANGLO_5_10

+C_ANGLOxFRANCO_25_60*PANGLO_25_60

+C_ANGLOxFRANCO_60*PANGLO_60)

+C_ALLO_0_1*PALLO_0_1

+C_ALLO_1_3*PALLO_1_3

+C_ALLO_10*PALLO_10

+1*C_ALLOxFRANCO_0_1*PALLO_0_1

+C_ALLOxFRANCO_1_3*PALLO_1_3

+C_ALLOxFRANCO_10*PALLO_10

+C_POT_0_500*POT_0_500

+C_POT_500_2000*POT_500_2000

+C_POT_5000_20000*POT_5000_20000

+C_POT_20000*POT_20000

+C_POP_0_5000*POP_0_5000

+C_POP_5_10000*POP_5_10000

+C_POP_25_75000*POP_25_75000

+C_POP_75000*POP_75000

+C_AUTOROUTE*AUTOROUTE

+C_DISTANCE*DISTANCE

+C_RIVE_NORD*RIVE_NORD

+C_RIVE_SUD*RIVE_SUD

+C_LONGUEUIL*LONGUEUIL

+C_LAVAL*LAVAL

+C_MONTREAL*MONTREAL

);

View solution in original post

3 REPLIES 3
Tom
Super User Tom
Super User

Just put in some end of lines.  Any where you want that doesn't split a variable name or keyword.  How about in front of every + sign?

expo1=exp(C_ANGLO_0_5*PANGLO_0_5

+C_ANGLO_5_10*PANGLO_5_10

+C_ANGLO_25_60*PANGLO_25_60

+C_ANGLO_60*PANGLO_60

+1*(C_ANGLOxFRANCO_0_5*PANGLO_0_5

+C_ANGLOxFRANCO_5_10*PANGLO_5_10

+C_ANGLOxFRANCO_25_60*PANGLO_25_60

+C_ANGLOxFRANCO_60*PANGLO_60)

+C_ALLO_0_1*PALLO_0_1

+C_ALLO_1_3*PALLO_1_3

+C_ALLO_10*PALLO_10

+1*C_ALLOxFRANCO_0_1*PALLO_0_1

+C_ALLOxFRANCO_1_3*PALLO_1_3

+C_ALLOxFRANCO_10*PALLO_10

+C_POT_0_500*POT_0_500

+C_POT_500_2000*POT_500_2000

+C_POT_5000_20000*POT_5000_20000

+C_POT_20000*POT_20000

+C_POP_0_5000*POP_0_5000

+C_POP_5_10000*POP_5_10000

+C_POP_25_75000*POP_25_75000

+C_POP_75000*POP_75000

+C_AUTOROUTE*AUTOROUTE

+C_DISTANCE*DISTANCE

+C_RIVE_NORD*RIVE_NORD

+C_RIVE_SUD*RIVE_SUD

+C_LONGUEUIL*LONGUEUIL

+C_LAVAL*LAVAL

+C_MONTREAL*MONTREAL

);

Demographer
Pyrite | Level 9

Thanks, it works. That's kind of weird that a so powerfull program like SAS still has bug like this one.

Reeza
Super User

/lrecl=500; after your %include, or however long the line is.

You can also break up the formula into multiple lines without having to split the formula into multiple formula's.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

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
  • 3 replies
  • 4818 views
  • 3 likes
  • 3 in conversation