BookmarkSubscribeRSS Feed
hema_bhure
Calcite | Level 5

Thanks In advance,

 

I have currencycode.csv file and i want to import into SAS using code but unable to import it.

currencycode.csv
-------------------------
------------------------------------------------
country code currencysymbol
------------------------------------------------
Australia AUT $
Austria AST €
canada CAD $
Belgium BEL €

I want to rea this special character in column currencysymbol in sas as it, could you please help me to read this csv file.

3 REPLIES 3
ballardw
Super User

Post an example of your data. Copy some lines using a TEXT editor, not a spreadsheet, and paste the values into a text box opened on the forum with the </>. The text box is important because the main message windows reformat text which can change the values pasted.

Copy from a text editor is critical because lines copied when opened by a spreadsheet would no longer be CSV.

 

Also, show the generated code from the log of what you attempted.

hema_bhure
Calcite | Level 5

Thank You so much for your time, I have tried through an SAS EG using import data option.

and the following code has been generated. and I need same output data n SAS data set.

 

Input data

----------------

CountryISOCode_2 CountryISOCode_3 CountryName CurrencyCode Region CurrencySymbol
AT AUT AUSTRIA EUR ACC €
BE BEL BELGIUM EUR ACC €
CZ CZE CZECH REPUBLIC CZK ACC Kč
DE DEU GERMANY EUR ACC €
ES ESP SPAIN EUR ACC €
NL NLD HOLLAND NLG ACC ƒ


 code generated through the the IMPORT DATA option in EG

-------------------------------------------------------------------------------------------

DATA WORK.'Copy of EU_Company'n;
30 LENGTH
31 CountryISOCode_2 $ 2
32 CountryISOCode_3 $ 3
33 CountryName $ 14
34 CurrencyCode $ 3
35 Region $ 4
36 CurrencySymbol $ 2 ;
37 FORMAT
38 CountryISOCode_2 $CHAR2.
39 CountryISOCode_3 $CHAR3.
40 CountryName $CHAR14.
41 CurrencyCode $CHAR3.
42 Region $CHAR4.
43 CurrencySymbol $CHAR2. ;
44 INFORMAT
45 CountryISOCode_2 $CHAR2.
46 CountryISOCode_3 $CHAR3.
47 CountryName $CHAR14.
48 CurrencyCode $CHAR3.
49 Region $CHAR4.
50 CurrencySymbol $CHAR2. ;
51 INFILE '/sas/files/excel/#LN00018'
52 LRECL=33
53 ENCODING="LATIN1"
54 TERMSTR=CRLF
55 DLM='7F'x
56 MISSOVER
57 DSD ;
58 INPUT
2 The SAS System 01:24 Monday, January 25, 2021

59 CountryISOCode_2 : $CHAR2.
60 CountryISOCode_3 : $CHAR3.
61 CountryName : $CHAR14.
62 CurrencyCode : $CHAR3.
63 Region : $CHAR4.
64 CurrencySymbol : $CHAR2. ;
65 RUN;

Kurt_Bremser
Super User

This is not data from a csv file. A csv file would have commas to separate the columns (and headers), or (in the case of an Excel-created csv) semicolons.

Please open the source file (not the file created by EG) with a text editor and copy/paste the contents into a window opened with the </> button. DO NOT SKIP THIS, to keep the formatting.

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