BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rajeshm
Quartz | Level 8
data firstdataset;
   input Score  13. Name : $10. (xyz1-xyz3)($1.);
datalines;
123456789012 raje Abc
1234567890123 nbvc Abc
65 aaaaa bbb
95 abdef ccc
;
proc print;run;

as per this code 13 digits has to be read for score varible.
q1: first line score 12 digits only..how it is displaying correct number in dataset? even though shortage of one digit

score has to read 13 digits in third line and it is giving error , i agree. but how come first line successfully ?read?

q2: 13 digit numbers ,how can i export into csv?as it is giving exponenetial numbers? when converting to numbers, those are truncating..

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

The code below works for me. But why do you need a 13 digit numeric? Why numeric, are you going to use it in some numerical way such as adding them up and finding an average? I doubt it. Such identifiers ought to be character, you would make your life much simpler if you made them character.

 

data firstdataset;
   input Score  13. Name : $10. (xyz1-xyz3)($1.);
   format score best16.;
datalines;
123456789012 raje Abc
1234567890123 nbvc Abc
65 aaaaa bbb
95 abdef ccc
;
--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

The code below works for me. But why do you need a 13 digit numeric? Why numeric, are you going to use it in some numerical way such as adding them up and finding an average? I doubt it. Such identifiers ought to be character, you would make your life much simpler if you made them character.

 

data firstdataset;
   input Score  13. Name : $10. (xyz1-xyz3)($1.);
   format score best16.;
datalines;
123456789012 raje Abc
1234567890123 nbvc Abc
65 aaaaa bbb
95 abdef ccc
;
--
Paige Miller
rajeshm
Quartz | Level 8
thanks for quick reply and suggestions.
I learned and worked on sas but still I am not comfortable with types of input methods(list,formatted,fixed) etc. how the compiler/pdv is preforming internally while these...will post another question shortly.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 967 views
  • 0 likes
  • 2 in conversation