I am creating a data file and when I copy and paste data from excel I have problems , it puts a tab instead of empty spaces
data uno; input a b c; datalines; 4 6 8 1 6 8 4 5 7 ; run;
I usually import but sometimes i need this kind of program
Yes, its another "feature" of Excel, when data is copied out it likes to split each cell, and tab is less likely to be in the data so it uses that. One thing you can do if you have to use Excel and copy and paste, is to merge cells using Excel:
https://www.ablebits.com/office-addins-blog/2015/07/15/excel-concatenate-strings-cells-columns/
Then use the one merged cell to copy over. However that really is just faffing about, either drop Excel totally, or just save to a CSV and read it in properly.
Perhaps there is some translation difficulty, but this code works perfectly well on my computer. What exactly is the problem you are experiencing?
You need to tell SAS that it has to use a different delimiter:
data uno;
infile datalines dlm='09'x;
input a b c;
datalines;
If there's a possibilty of empty cells (two tabs in succession), also add the dsd option.
Yes, its another "feature" of Excel, when data is copied out it likes to split each cell, and tab is less likely to be in the data so it uses that. One thing you can do if you have to use Excel and copy and paste, is to merge cells using Excel:
https://www.ablebits.com/office-addins-blog/2015/07/15/excel-concatenate-strings-cells-columns/
Then use the one merged cell to copy over. However that really is just faffing about, either drop Excel totally, or just save to a CSV and read it in properly.
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!
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.