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

Hi

 

I am new to SAS and trying to read a data set with European format.  Comma means the decimal point in this data set.  Single space is the delimiter. Each value represents one input variable.    I tried to use euro10. read the following data and got nothing.  

 

Here is the example of my data set.

29,048 45,195 29,048 113,36 114,29 113,98 29,693 29,805 29,765 33,698 33,813 33,775 43,4 43,8 43,53 32,409 32,409 32,409 22,933 22,933 22,933 1,02 1,04 1,03 30,999 30,999 30,999 161,907 162,804 162,209 6,947 7,247 7,067 8,019 8,466 8,183 7,76 7,951 7,814 9,099 9,496 9,154

 

Any help is appreciated!

Thanks

Margaret

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

The COMMAX format will reverse the role of the comma and decimal point in numeric values.

data example;
   informat x commax10.3;
   input x;
   format x best10.;
datalines;
29,048 
45,195 
29,048 
113,36 
114,29 
113,98 
;
run;

View solution in original post

7 REPLIES 7
ballardw
Super User

The COMMAX format will reverse the role of the comma and decimal point in numeric values.

data example;
   informat x commax10.3;
   input x;
   format x best10.;
datalines;
29,048 
45,195 
29,048 
113,36 
114,29 
113,98 
;
run;
Learningforfun
Calcite | Level 5

Kurt,

 

Thanks for the suggestion on commax10.3.  It worked.  Can you show me how to separate those values because each value represents one variable.  I tried to use dsd and truncover to separate these values, and didn't get anything.

 

29,048 45,195 29,048 113,36 114,29 113,98 29,693 29,805 29,765 33,698 33,813 33,775 43,4 43,8 43,53 32,409 32,409 32,409 22,933 22,933 22,933 1,02 1,04 1,03 30,999 30,999 30,999 161,907 162,804 162,209 6,947 7,247 7,067 8,019 8,466 8,183 7,76 7,951 7,814 9,099 9,496 9,154

 

Thanks

Margaret

Kurt_Bremser
Super User

@Learningforfun wrote:

Kurt,

 

Thanks for the suggestion on commax10.3.  It worked.  Can you show me how to separate those values because each value represents one variable.  I tried to use dsd and truncover to separate these values, and didn't get anything.

 

29,048 45,195 29,048 113,36 114,29 113,98 29,693 29,805 29,765 33,698 33,813 33,775 43,4 43,8 43,53 32,409 32,409 32,409 22,933 22,933 22,933 1,02 1,04 1,03 30,999 30,999 30,999 161,907 162,804 162,209 6,947 7,247 7,067 8,019 8,466 8,183 7,76 7,951 7,814 9,099 9,496 9,154

 

Thanks

Margaret


For that I would need to see your code, and at least one line of the infile (post as attachment, or use the {i} button).

Learningforfun
Calcite | Level 5

Hi Kurt,

 

I tried to import the attached data by using the following code.  I was able to get Zeit (time), but not the remaining variables.

 

I appreciate your help.

Margaret 

 

data testdata;
infile 'C:........' dsd;
informat zeit time8.2 a1-a60 commax10.3;
input zeit a1-a60;
format zeit time8.2 a1-a60 best10.;
run;

ballardw
Super User

@Learningforfun wrote:

Kurt,

 

Thanks for the suggestion on commax10.3.  It worked.  Can you show me how to separate those values because each value represents one variable.  I tried to use dsd and truncover to separate these values, and didn't get anything.

 

29,048 45,195 29,048 113,36 114,29 113,98 29,693 29,805 29,765 33,698 33,813 33,775 43,4 43,8 43,53 32,409 32,409 32,409 22,933 22,933 22,933 1,02 1,04 1,03 30,999 30,999 30,999 161,907 162,804 162,209 6,947 7,247 7,067 8,019 8,466 8,183 7,76 7,951 7,814 9,099 9,496 9,154

 

Thanks

Margaret


If you mean these are all supposed to be read into a single variable with each value a separate observation then this might get you started:

data example;
   informat x commax10.3;
   input x @@;
datalines;
29,048 45,195 29,048 113,36 114,29 113,98 29,693 29,805 29,765 33,698 33,813 33,775 43,4 43,8 43,53 32,409 32,409 32,409 22,933 22,933 22,933 1,02 1,04 1,03 30,999 30,999 30,999 161,907 162,804 162,209 6,947 7,247 
;
run;

@the @@ at the end of an input line means to stay on the same record until you reach the end of the data.

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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