I think I have actually found the answer to my problem. SAS is trying to open the dataset in Work.tablename and SQLyog is only sending it the tablename. I need to send it libname.tablename, for example if I am trying to import a table called Facts, SAS tries to open Work.Facts and obviously can't find it since it is part of the library factdata and thus must be referred to as factdata.Facts for SAS to know where to find it. Looks like I am going to have to write a SQL query for this.