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

Hi,

I have a problem to import this file csv with these column:(in a I have the point, while in b I have the comma)

a          b                  

1          1,048

           356,8

3          6764

0.1       564

4          0,0019

1          0,0678

Obviously, I will have to do, some arithimetics operation between this coloumn and with other column from other table with COMMAX7.3 format.

have you any idea how to build the input statment in a data step?

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

Can't u just use the commaxw informat?  e.g.:

data have;

  input a  b;

  informat b commax7.;

  format b best32.;

  cards;

1          1,048

           356,8

3          6764

0.1       564

4          0,0019

1          0,0678

;

View solution in original post

3 REPLIES 3
art297
Opal | Level 21

Can't u just use the commaxw informat?  e.g.:

data have;

  input a  b;

  informat b commax7.;

  format b best32.;

  cards;

1          1,048

           356,8

3          6764

0.1       564

4          0,0019

1          0,0678

;

Rakeon
Quartz | Level 8

Thanks!

art297
Opal | Level 21

Of course, if your csv is actually comma delimited as well, you'll have to account for the delimiter.  e.g., something like the following should work:

data have;

  infile cards dlm='~';

  input @;

  _infile_=substr(_infile_,1,find(_infile_,',')-1)||"~"||

   substr(_infile_,find(_infile_,',')+1);

  input a  b;

  informat b commax7.;

  format b best32.;

  cards;

1,1,048

,356,8

3,6764

0.1,564

4,0,0019

1,0,0678

;

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
  • 3 replies
  • 790 views
  • 3 likes
  • 2 in conversation