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.
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.
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.