DATA Step, Macro, Functions and more

Please let me know the reason

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 139
Accepted Solution

Please let me know the reason

Hi,

I am not able to find out why in the last variable i am getting data as 'q' only.I expect to get 'qw'.

DATA xyz;
INPUT (x1 - x5) ($2.);
ARRAY expl(5) x1 - x5;
PUT _ALL_;
DATALINES;
aabbccddee
mkjkasrdas
aabbccddee
retesferqw
;
run;
abc.bmp
however when i write following code i am getting the result as expected.
DATA xyz2;
INPUT (x1 - x5) ($);
ARRAY expl(5) x1 - x5;
PUT _ALL_;
DATALINES;
aa  bb  cc  dd  ee

mk  jk  as  rd  as

aa  bb  cc  dd  ee

re  te  sf  er  qw
;
run;


Accepted Solutions
Solution
‎07-18-2011 09:26 AM
PROC Star
Posts: 7,467

Please let me know the reason

Posted in reply to manojinpec

It is only the size of the font that is keeping the value from showing in your first example.  E.g., if you were to put the record that has the qw for x5 in the first position, that is the one that would only show 1 character.

DATA xyz;

  INPUT (x1 - x5) ($2.);

  DATALINES;

aabbccddqw

mkjkasrdas

aabbccddee

retesferee

;

run;

In your second example you used a default of 8 characters in the format .. more than enough to show the two characters regardless of which two they were.

View solution in original post


All Replies
SAS Employee
Posts: 104

Please let me know the reason

Posted in reply to manojinpec

Run a PROC PRINT on your data and you will find that the data is just fine.  Your SAS Viewer XF column is just not wide enough to show all of the text.  You can re-size the column by dragging the right boundary of the X5 column header over to the right, and you'll see the rest of your text.

Frequent Contributor
Posts: 139

Please let me know the reason

Hi SAS jedi ,

Two Questions:

1. If SAS viewer column is not wide enough then it should not show the all the records on variable X5.Also when i use this dataset i am able to get the record with condition if X5='q'.

2. How it showing good in my secod data step when i am entering the data with blank as delimiter.

Regards,

Manoj

Solution
‎07-18-2011 09:26 AM
PROC Star
Posts: 7,467

Please let me know the reason

Posted in reply to manojinpec

It is only the size of the font that is keeping the value from showing in your first example.  E.g., if you were to put the record that has the qw for x5 in the first position, that is the one that would only show 1 character.

DATA xyz;

  INPUT (x1 - x5) ($2.);

  DATALINES;

aabbccddqw

mkjkasrdas

aabbccddee

retesferee

;

run;

In your second example you used a default of 8 characters in the format .. more than enough to show the two characters regardless of which two they were.

🔒 This topic is solved and locked.

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

Discussion stats
  • 3 replies
  • 195 views
  • 7 likes
  • 3 in conversation