BookmarkSubscribeRSS Feed
rohithverma
Obsidian | Level 7

Hi All,

I had a value in csv file where the backend data within that value contain two parts.How can i resolve those internal values and read into sas .

 

Please find the screen shot below.

 

rohithverma_0-1586973679262.png

 

4 REPLIES 4
ballardw
Super User

How did you read the csv file? If using a data step then read that column as character and parse the value if you need the two numbers. You don't really show us what you expect for the output.

 

Unless you are careful you may no longer have the same values after opening the file in Excel if you saved it afterwards.

 

 

RichardDeVen
Barite | Level 11

The dynamic resolution of an expression at DATA step run-time can be accomplishing by RESOLVEing the expression in the macro environment with the %SYSEVALF macro function.  Note the leading equals sign (=) will need to be ignored for proper evaluation.  RESOLVE returns the character string representing the formula result, so that return also needs to be INPUT. 

 

Example:

data x;
  remarks = '=1/7';

  if remarks =: '=' 
    then remarks_eval = input(resolve ('%sysevalf(' || substr(remarks,2) || ')' ), best12.);

  x = 1 / 7;
  delta = x - remarks_eval;

  put x= remarks_eval= delta=;
run;

Note: Some very small differences may be noticed between the actual ratio and the macro resolution of the ratio.

           x=0.1428571429
remarks_eval=0.1428571428
delta=5.714285E-11
fdsaaaa
Obsidian | Level 7

It can't be done as far as I can see. The screenshot is from excel . But if you save as .csv then you can no longer get the formula used to create the value in the cell . Try opening the csv up again in excel and you will see there is no longer a formula . This is all before it has even touched SAS .

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 708 views
  • 0 likes
  • 5 in conversation