HI:
First -- are you doing this in a Stored Process or using the SAS Add-in for Microsoft Office??? If you are NOT doing this in the context of a Stored Process then you should move or repost a new version of this question probably to the ODS and Base SAS Reporting forum (assuming you want to generate a report that you can open in Excel). If you are using the SAS Add-in for Microsoft Office and stored processes, then I would really suggest that you move your question to Tech Support.
There seems to be some discrepancies between your original post and this post. In your original post, you said you had a CSV file. Now, in this post, you say you have an Excel file. Does this mean that you have 1 workbook with 2 worksheets (case1 and case2)?? Or do you have 2 separate workbooks -- a case1 workbook or a case 2 workbook??? An "Excel file" is not the same as a CSV file -- unless you are saving the Excel file as a CSV file and you are showing your "version" of what's in the Excel file. If you indeed have a CSV file, I would prefer to see that posted. As you will see, the answer to your questions really depend on accuracy of information about the input file and the type of output you want to create.
Your questions:
1. what is a best way to read in the file to a dataset? it is a good practice to read in the titles for both case 1 and case2?
-- If you have a CSV file, you can read the CSV file with either a DATA step program or with PROC IMPORT
--If you have an Excel workbook, you can read the Excel workbook with either PROC IMPORT or the SAS Excel LIBNAME engine (or the ODBC engine or the OLE-DB engine)
SAS expects your input data to be rectangular in structure -- rows and columns with no embedded graphs, for example. By default, if your Excel sheet has titles or formulas, SAS will not retain those in the SAS dataset.
2. how can i add in two additional columns for both case 1 and case2 and reproduce the output by using the same format as above; wih the final report how to have the user to view the formulas set in the original spreadsheet file?
--As I explained above, once you read the data into a SAS dataset, there is no visibility of the formulas from the original workbook/worksheet. SAS could create the 2 additional columns you want in a variety of different ways. Once you have your data in a SAS dataset, you could use PROC SQL or a DATA step program to add the new columns to the data. If you want to add columns onto a report, then the best way to do that is with PROC REPORT.
3. is possible to add additional columns with group values to the output file.
--I have a hard time understanding what you mean by addition COLUMNS, since what you used as an example looks like 3 columns under one header called 'MyValue'. I suspect that this issue is the least of your worries -- if you were generating a report, as I said, there are ways to use a COMPUTE block with PROC REPORT to generate extra columns and ways with PROC REPORT to generate extra summary rows.
But until you resolve #1 and clarify what your input data is and how you will get it into SAS; and resolve #2 - -the issue with somehow retaining the Excel formulas -- #3 is almost irrelevant until #1 and #2 are solved.
cynthia
... View more