Hi All,
Which codes to use to address the problem where the decription appears in the next cell? I wish to turn the informaiton which has over 5000 rows into a table .For example:t changing the Table 1 which is csv format to Table 2
Table 1 Csv format
85415900,"Other semiconductor devices, other than semiconductor-based transducers, other | |||||
than photosensitive devices, nesoi" |
Table 2
HS code | Description |
85415900 | Other semiconductor devices, other than semiconductor-based transducers, otherthan photosensitive devices, nesoi". |
You may have an embedded carriage return in your quoted string. You can try the following:
https://support.sas.com/kb/26/065.html
From the description is looks like the CSV file has end-of-line characters in the value of one of the fields.
If you are lucky it only has CR or LF in the field value and uses CR-LF as the end-of-line marker.
Try reading the file using the TERMSTR=CRLF option on the INFILE (or FILENAME) statement.
If the fields contain the same characters as used for the end-of-line markers then you will need to preprocess the file. Since it looks like the field with the end-of-line marker is quoted you can use something that counts the number of quotes on a line to detect and remove or replace them.
Try this macro to make a copy of the CSV file with the embedded CR and LF characters replaced (or removed):
https://github.com/sasutils/macros/blob/master/replace_crlf.sas
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.