DATA Step, Macro, Functions and more

Can someone please tell why Division has length of 9 in the below code?

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

Can someone please tell why Division has length of 9 in the below code?

data names;
    title='EDU';
    if title='EDU' then
        Division='Education';
    else if title='HR' then
        Division='Human Resources';
    else Division='Unknown';
run;

When I ran proc content for this code I get the length of 9 for Division variable but by default, it should have 8 isn't it?

 

Any help would be highly appreciated 

Pankajwa

Accepted Solutions
Solution
‎06-03-2018 06:20 AM
Super User
Posts: 3,914

Re: Can someone please tell why Division has length of 9 in the below code?

[ Edited ]

I suggest you count the number of letters in the string Education more carefully as this is what defines the length of Division:

Division='Education'

 

View solution in original post


All Replies
Solution
‎06-03-2018 06:20 AM
Super User
Posts: 3,914

Re: Can someone please tell why Division has length of 9 in the below code?

[ Edited ]

I suggest you count the number of letters in the string Education more carefully as this is what defines the length of Division:

Division='Education'

 

Occasional Contributor
Posts: 17

Re: Can someone please tell why Division has length of 9 in the below code?

the first occurence div got is education and hence the length is 9.
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 119 views
  • 2 likes
  • 3 in conversation