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
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;
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;
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
@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).
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;
@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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.