BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
manojinpec
Obsidian | Level 7

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;

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

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

3 REPLIES 3
SASJedi
SAS Super FREQ

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.

Check out my Jedi SAS Tricks for SAS Users
manojinpec
Obsidian | Level 7

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

art297
Opal | Level 21

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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